{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "04bbe4de",
   "metadata": {},
   "source": [
    "* HTTP请求 GET、POST\n",
    "* JSON（主要）/XML用于数据交换\n",
    "* POI 兴趣点"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e0e9c5c3",
   "metadata": {},
   "source": [
    "# 1.Web服务API简介"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9adec6aa",
   "metadata": {},
   "source": [
    "* 高德Web服务API向开发者提供HTTP接口，开发者可通过这些接口使用各类型的地理数据服务，返回结果支持JSON和XML格式。Web服务API对所有用户开放。使用本组服务之前，需要申请应用Key。不同类型用户可获取不同的数据访问能力。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "11c285a1",
   "metadata": {},
   "source": [
    "# 2.地理/逆地理编码\n",
    "* 结构化地址:\n",
    "> 首先，地址肯定是一串字符，内含国家、省份、城市、区县、城镇、乡村、街道、门牌号码、屋邨、大厦等建筑物名称。按照由大区域名称到小区域名称组合在一起的字符。一个有效的地址应该是独一无二的。注意：针对大陆、港、澳地区的地理编码转换时可以将国家信息选择性的忽略，但省、市、城镇等级别的地址构成是不能忽略的。暂时不支持返回台湾省的详细地址信息。\n",
    "\n",
    "* 结构化地址<--->经纬度\n",
    "> 地理编码/逆地理编码 API 是通过 HTTP/HTTPS 协议访问远程服务的接口，提供结构化地址与经纬度之间的相互转化的能力"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7c27f4e0",
   "metadata": {},
   "source": [
    "## 2.1 地理编码"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "26a1fa41",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 1. 调用requests模块（打开一个 google chrome 浏览器）\n",
    "import requests"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "39b0ef05",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 2.请求方法：GET\n",
    "# 3.请求的地理编码url地址：https://restapi.amap.com/v3/geocode/geo?parameters\n",
    "geo_url = \"https://restapi.amap.com/v3/geocode/geo?parameters\"\n",
    "\n",
    "# 4.请求的参数（payload）\n",
    "payload = {\n",
    "    \"key\":\"091c69bb3b356e0f0eb237e4e7a62a45\",\n",
    "    \"address\":\"广东省广州市从化区广州南方学院\"\n",
    "}\n",
    "# 5.发起请求\n",
    "r = requests.get(url=geo_url,params=payload)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "7404587b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Response [200]>"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "7a078cc4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'status': '1',\n",
       " 'info': 'OK',\n",
       " 'infocode': '10000',\n",
       " 'count': '1',\n",
       " 'geocodes': [{'formatted_address': '广东省广州市从化区温泉镇中心大学南方学院',\n",
       "   'country': '中国',\n",
       "   'province': '广东省',\n",
       "   'citycode': '020',\n",
       "   'city': '广州市',\n",
       "   'district': '从化区',\n",
       "   'township': [],\n",
       "   'neighborhood': {'name': [], 'type': []},\n",
       "   'building': {'name': [], 'type': []},\n",
       "   'adcode': '440117',\n",
       "   'street': [],\n",
       "   'number': [],\n",
       "   'location': '113.678280,23.628439',\n",
       "   'level': '兴趣点'}]}"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "79bc0207",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'formatted_address': '广东省广州市从化区温泉镇中心大学南方学院',\n",
       "  'country': '中国',\n",
       "  'province': '广东省',\n",
       "  'citycode': '020',\n",
       "  'city': '广州市',\n",
       "  'district': '从化区',\n",
       "  'township': [],\n",
       "  'neighborhood': {'name': [], 'type': []},\n",
       "  'building': {'name': [], 'type': []},\n",
       "  'adcode': '440117',\n",
       "  'street': [],\n",
       "  'number': [],\n",
       "  'location': '113.678280,23.628439',\n",
       "  'level': '兴趣点'}]"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r.json()['geocodes']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "9fbbb5e1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'formatted_address': '广东省广州市从化区温泉镇中心大学南方学院',\n",
       " 'country': '中国',\n",
       " 'province': '广东省',\n",
       " 'citycode': '020',\n",
       " 'city': '广州市',\n",
       " 'district': '从化区',\n",
       " 'township': [],\n",
       " 'neighborhood': {'name': [], 'type': []},\n",
       " 'building': {'name': [], 'type': []},\n",
       " 'adcode': '440117',\n",
       " 'street': [],\n",
       " 'number': [],\n",
       " 'location': '113.678280,23.628439',\n",
       " 'level': '兴趣点'}"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r.json()['geocodes'][0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "05e6643d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'113.678280,23.628439'"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "广州南方学院_地理编码 = r.json()['geocodes'][0]['location']\n",
    "广州南方学院_地理编码"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "11fcbe1f",
   "metadata": {},
   "source": [
    "## 2.2逆地理编码"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "cb6fad55",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 2.请求方法：GET\n",
    "# 3.请求的逆地理编码url地址：https://restapi.amap.com/v3/geocode/regeo?parameters\n",
    "regeo_url = \"https://restapi.amap.com/v3/geocode/regeo?parameters\"\n",
    "\n",
    "# 4.请求的参数（payload）\n",
    "payload = {\n",
    "    \"key\":\"091c69bb3b356e0f0eb237e4e7a62a45\",\n",
    "    \"location\":广州南方学院_地理编码\n",
    "}\n",
    "# 5.发起请求\n",
    "r = requests.get(url=regeo_url,params=payload)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "ca0ded63",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'status': '1',\n",
       " 'regeocode': {'addressComponent': {'city': '广州市',\n",
       "   'province': '广东省',\n",
       "   'adcode': '440117',\n",
       "   'district': '从化区',\n",
       "   'towncode': '440117100000',\n",
       "   'streetNumber': {'number': '24号',\n",
       "    'location': '113.677267,23.629149',\n",
       "    'direction': '西北',\n",
       "    'distance': '129.943',\n",
       "    'street': '博学路'},\n",
       "   'country': '中国',\n",
       "   'township': '温泉镇',\n",
       "   'businessAreas': [[]],\n",
       "   'building': {'name': [], 'type': []},\n",
       "   'neighborhood': {'name': [], 'type': []},\n",
       "   'citycode': '020'},\n",
       "  'formatted_address': '广东省广州市从化区温泉镇博学路广州南方学院'},\n",
       " 'info': 'OK',\n",
       " 'infocode': '10000'}"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "1f04d049",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 2.请求方法：GET\n",
    "# 3.请求的逆地理编码url地址：https://restapi.amap.com/v3/geocode/regeo?parameters\n",
    "regeo_url = \"https://restapi.amap.com/v3/geocode/regeo?parameters\"\n",
    "\n",
    "# 4.请求的参数（payload）\n",
    "payload = {\n",
    "    \"key\":\"091c69bb3b356e0f0eb237e4e7a62a45\",\n",
    "    \"location\":广州南方学院_地理编码,\n",
    "    \"extensions\":\"all\",  # 返回信息设置为可以选择的\n",
    "    \"poitype\":\"true\"  # 开启附近搜索POI\n",
    "}\n",
    "# 5.发起请求\n",
    "r = requests.get(url=regeo_url,params=payload)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "e22e7669",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c0e944de",
   "metadata": {},
   "outputs": [],
   "source": [
    "天选之饭--周边--（中餐厅、外国餐厅、快餐厅、休闲餐厅）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "46826ff4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "      <th>type</th>\n",
       "      <th>tel</th>\n",
       "      <th>direction</th>\n",
       "      <th>distance</th>\n",
       "      <th>location</th>\n",
       "      <th>address</th>\n",
       "      <th>poiweight</th>\n",
       "      <th>businessarea</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>B00140MR9A</td>\n",
       "      <td>广州南方学院</td>\n",
       "      <td>科教文化服务;学校;高等院校</td>\n",
       "      <td>020-87828988;020-61787331</td>\n",
       "      <td>北</td>\n",
       "      <td>470.792</td>\n",
       "      <td>113.679257,23.632577</td>\n",
       "      <td>温泉大道882号</td>\n",
       "      <td>0.450402</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>B0FFG4TAF2</td>\n",
       "      <td>广州南方公寓</td>\n",
       "      <td>商务住宅;商务住宅相关;商务住宅相关</td>\n",
       "      <td>13622768437</td>\n",
       "      <td>东南</td>\n",
       "      <td>102.617</td>\n",
       "      <td>113.678983,23.627778</td>\n",
       "      <td>温泉镇乌土村松浪队5号(近博学路)</td>\n",
       "      <td>0.237309</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>B0H6FA18J5</td>\n",
       "      <td>保利半山花园</td>\n",
       "      <td>商务住宅;住宅区;住宅区</td>\n",
       "      <td>[]</td>\n",
       "      <td>东南</td>\n",
       "      <td>139.054</td>\n",
       "      <td>113.679358,23.627672</td>\n",
       "      <td>从莞深高速(广州南方学院南侧)</td>\n",
       "      <td>0.223065</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>B00140TWHT</td>\n",
       "      <td>教工住宅1号</td>\n",
       "      <td>商务住宅;住宅区;住宅小区</td>\n",
       "      <td>[]</td>\n",
       "      <td>北</td>\n",
       "      <td>222.658</td>\n",
       "      <td>113.678490,23.630432</td>\n",
       "      <td>笃行路2</td>\n",
       "      <td>0.157653</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>B0FFHRJDM9</td>\n",
       "      <td>中南公寓</td>\n",
       "      <td>商务住宅;住宅区;住宅小区</td>\n",
       "      <td>13711245345</td>\n",
       "      <td>东南</td>\n",
       "      <td>231.223</td>\n",
       "      <td>113.680340,23.627566</td>\n",
       "      <td>中大南方学院南门1号</td>\n",
       "      <td>0.256152</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>B0HGD588HJ</td>\n",
       "      <td>广州南方学院教学楼4号</td>\n",
       "      <td>科教文化服务;学校;学校</td>\n",
       "      <td>[]</td>\n",
       "      <td>北</td>\n",
       "      <td>242.901</td>\n",
       "      <td>113.677460,23.630490</td>\n",
       "      <td>博学路</td>\n",
       "      <td>0.221662</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>B0FFHZH0IK</td>\n",
       "      <td>地下铁</td>\n",
       "      <td>餐饮服务;冷饮店;冷饮店</td>\n",
       "      <td>[]</td>\n",
       "      <td>西北</td>\n",
       "      <td>74.1376</td>\n",
       "      <td>113.677941,23.629029</td>\n",
       "      <td>博学路广州南方学院综合楼内</td>\n",
       "      <td>0.17934</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>B0HGDU76L2</td>\n",
       "      <td>广州南方学院2号实验楼</td>\n",
       "      <td>科教文化服务;学校;学校</td>\n",
       "      <td>[]</td>\n",
       "      <td>北</td>\n",
       "      <td>280.003</td>\n",
       "      <td>113.678211,23.630956</td>\n",
       "      <td>博学路</td>\n",
       "      <td>0.221662</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>B0FFKP838K</td>\n",
       "      <td>教学楼3号(外国语学院)</td>\n",
       "      <td>科教文化服务;学校;高等院校</td>\n",
       "      <td>[]</td>\n",
       "      <td>北</td>\n",
       "      <td>298.093</td>\n",
       "      <td>113.677247,23.630947</td>\n",
       "      <td>博学路25</td>\n",
       "      <td>0.191742</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>B0FFKSF1FI</td>\n",
       "      <td>香辣螺蛳粉</td>\n",
       "      <td>餐饮服务;餐饮相关场所;餐饮相关</td>\n",
       "      <td>17820061022</td>\n",
       "      <td>西</td>\n",
       "      <td>209.206</td>\n",
       "      <td>113.676231,23.628565</td>\n",
       "      <td>广州南方学院西4123</td>\n",
       "      <td>0.209252</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>B0HGDU8NLD</td>\n",
       "      <td>广州南方学院1号实验楼</td>\n",
       "      <td>科教文化服务;学校;学校</td>\n",
       "      <td>[]</td>\n",
       "      <td>北</td>\n",
       "      <td>326.007</td>\n",
       "      <td>113.678215,23.631370</td>\n",
       "      <td>博学路附近</td>\n",
       "      <td>0.221662</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>B0FFLF90I2</td>\n",
       "      <td>煌上煌酱鸭(南方学院店)</td>\n",
       "      <td>餐饮服务;快餐厅;快餐厅</td>\n",
       "      <td>13712317721</td>\n",
       "      <td>东北</td>\n",
       "      <td>256.772</td>\n",
       "      <td>113.679965,23.630156</td>\n",
       "      <td>笃行路20、22、24号广州南方学院商业中心1层1F015</td>\n",
       "      <td>0.209448</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>B0HGD58UTU</td>\n",
       "      <td>广州南方学院2号教学楼</td>\n",
       "      <td>科教文化服务;学校;学校</td>\n",
       "      <td>[]</td>\n",
       "      <td>西北</td>\n",
       "      <td>346.352</td>\n",
       "      <td>113.677060,23.631346</td>\n",
       "      <td>博学路</td>\n",
       "      <td>0.191229</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>B0H25SMRKP</td>\n",
       "      <td>广州南方学院大礼堂</td>\n",
       "      <td>科教文化服务;会展中心;会展中心</td>\n",
       "      <td>[]</td>\n",
       "      <td>东北</td>\n",
       "      <td>386.65</td>\n",
       "      <td>113.680076,23.631502</td>\n",
       "      <td>温泉大道882号</td>\n",
       "      <td>0.261624</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>B0HGDU92JD</td>\n",
       "      <td>广州南方学院教学楼1号</td>\n",
       "      <td>科教文化服务;学校;学校</td>\n",
       "      <td>[]</td>\n",
       "      <td>北</td>\n",
       "      <td>391.548</td>\n",
       "      <td>113.677077,23.631783</td>\n",
       "      <td>博学路19号</td>\n",
       "      <td>0.221662</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>B0HGD592BJ</td>\n",
       "      <td>广州南方学院综合楼</td>\n",
       "      <td>科教文化服务;学校;学校</td>\n",
       "      <td>[]</td>\n",
       "      <td>东北</td>\n",
       "      <td>392.731</td>\n",
       "      <td>113.680117,23.631544</td>\n",
       "      <td>温泉大道886号广州南方学院内</td>\n",
       "      <td>0.221662</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>B0FFKP81F0</td>\n",
       "      <td>教学楼1号(文学与传媒学院)</td>\n",
       "      <td>科教文化服务;科教文化场所;科教文化场所</td>\n",
       "      <td>[]</td>\n",
       "      <td>西北</td>\n",
       "      <td>393.93</td>\n",
       "      <td>113.676866,23.631736</td>\n",
       "      <td>博学路19号附近</td>\n",
       "      <td>0.191742</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>B0FFLBEOND</td>\n",
       "      <td>聚贤楼10号</td>\n",
       "      <td>商务住宅;住宅区;宿舍</td>\n",
       "      <td>[]</td>\n",
       "      <td>东北</td>\n",
       "      <td>418.51</td>\n",
       "      <td>113.681253,23.631036</td>\n",
       "      <td>从莞深高速(广州南方学院)</td>\n",
       "      <td>0.190963</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>B0FFH6K3U9</td>\n",
       "      <td>广州中大南方招待所</td>\n",
       "      <td>住宿服务;住宿服务相关;住宿服务相关</td>\n",
       "      <td>020-61787222</td>\n",
       "      <td>西北</td>\n",
       "      <td>378.102</td>\n",
       "      <td>113.676330,23.631332</td>\n",
       "      <td>温泉镇温泉大道882号广州南方学院H7栋1-5层</td>\n",
       "      <td>0.254885</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>B0HGD58NF8</td>\n",
       "      <td>广州南方学院达人书院</td>\n",
       "      <td>科教文化服务;科教文化场所;科教文化场所</td>\n",
       "      <td>[]</td>\n",
       "      <td>北</td>\n",
       "      <td>446.366</td>\n",
       "      <td>113.679041,23.632392</td>\n",
       "      <td>温泉大道882号广州南方学院新综合楼2层</td>\n",
       "      <td>0.191229</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>B0FFKUVYWV</td>\n",
       "      <td>广州和风庭阿七度假别墅</td>\n",
       "      <td>住宿服务;住宿服务相关;住宿服务相关</td>\n",
       "      <td>[]</td>\n",
       "      <td>东北</td>\n",
       "      <td>424.35</td>\n",
       "      <td>113.681736,23.630569</td>\n",
       "      <td>保利桃花源</td>\n",
       "      <td>0.273168</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>B0HGDU99RM</td>\n",
       "      <td>广州南方学院图书馆</td>\n",
       "      <td>科教文化服务;图书馆;图书馆</td>\n",
       "      <td>020-61787368;020-61787371</td>\n",
       "      <td>北</td>\n",
       "      <td>489.331</td>\n",
       "      <td>113.679177,23.632762</td>\n",
       "      <td>温泉大道882号广州南方学院内</td>\n",
       "      <td>0.257947</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>B0HGDU92JC</td>\n",
       "      <td>广州南方学院4号实验楼</td>\n",
       "      <td>科教文化服务;学校;学校</td>\n",
       "      <td>[]</td>\n",
       "      <td>北</td>\n",
       "      <td>498.883</td>\n",
       "      <td>113.679963,23.632652</td>\n",
       "      <td>博学路附近</td>\n",
       "      <td>0.221662</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>B0FFL7C054</td>\n",
       "      <td>广州U优森特酒店</td>\n",
       "      <td>住宿服务;住宿服务相关;住宿服务相关</td>\n",
       "      <td>15813395296</td>\n",
       "      <td>北</td>\n",
       "      <td>464.819</td>\n",
       "      <td>113.679226,23.632528</td>\n",
       "      <td>温泉镇博学路882号(广州南方学院商业中心1层)</td>\n",
       "      <td>0.317505</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>B0FFG8CSEK</td>\n",
       "      <td>L5员工宿舍</td>\n",
       "      <td>商务住宅;住宅区;宿舍</td>\n",
       "      <td>[]</td>\n",
       "      <td>东北</td>\n",
       "      <td>554.129</td>\n",
       "      <td>113.682583,23.631487</td>\n",
       "      <td>从莞深高速(广州南方学院)</td>\n",
       "      <td>0.185371</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>B0HGD58FR2</td>\n",
       "      <td>广州南方学院教学楼9号</td>\n",
       "      <td>科教文化服务;学校;学校</td>\n",
       "      <td>[]</td>\n",
       "      <td>北</td>\n",
       "      <td>532.163</td>\n",
       "      <td>113.679747,23.633032</td>\n",
       "      <td>广州南方学院</td>\n",
       "      <td>0.221662</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>B0HG5Z9JNK</td>\n",
       "      <td>广州南方学院教学楼7号</td>\n",
       "      <td>科教文化服务;学校;学校</td>\n",
       "      <td>[]</td>\n",
       "      <td>北</td>\n",
       "      <td>544.868</td>\n",
       "      <td>113.678600,23.633330</td>\n",
       "      <td>博学路</td>\n",
       "      <td>0.221553</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>B0HGD599JM</td>\n",
       "      <td>广州南方学院第11教学楼</td>\n",
       "      <td>科教文化服务;学校;学校</td>\n",
       "      <td>[]</td>\n",
       "      <td>北</td>\n",
       "      <td>556.036</td>\n",
       "      <td>113.680037,23.633173</td>\n",
       "      <td>温泉大道882号广州南方学院</td>\n",
       "      <td>0.221662</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>B0GUJYPEG2</td>\n",
       "      <td>怒烤烤串(从化店)</td>\n",
       "      <td>餐饮服务;中餐厅;特色/地方风味餐厅</td>\n",
       "      <td>[]</td>\n",
       "      <td>北</td>\n",
       "      <td>510.112</td>\n",
       "      <td>113.677160,23.632910</td>\n",
       "      <td>温泉大道882号广州南方学院内博学路6号之3</td>\n",
       "      <td>0.216026</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>B0HGDU6Z41</td>\n",
       "      <td>广州南方学院教学楼6号</td>\n",
       "      <td>科教文化服务;学校;学校</td>\n",
       "      <td>[]</td>\n",
       "      <td>北</td>\n",
       "      <td>586.331</td>\n",
       "      <td>113.678424,23.633710</td>\n",
       "      <td>温泉大道882</td>\n",
       "      <td>0.221662</td>\n",
       "      <td>[]</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            id            name                  type  \\\n",
       "0   B00140MR9A          广州南方学院        科教文化服务;学校;高等院校   \n",
       "1   B0FFG4TAF2          广州南方公寓    商务住宅;商务住宅相关;商务住宅相关   \n",
       "2   B0H6FA18J5          保利半山花园          商务住宅;住宅区;住宅区   \n",
       "3   B00140TWHT          教工住宅1号         商务住宅;住宅区;住宅小区   \n",
       "4   B0FFHRJDM9            中南公寓         商务住宅;住宅区;住宅小区   \n",
       "5   B0HGD588HJ     广州南方学院教学楼4号          科教文化服务;学校;学校   \n",
       "6   B0FFHZH0IK             地下铁          餐饮服务;冷饮店;冷饮店   \n",
       "7   B0HGDU76L2     广州南方学院2号实验楼          科教文化服务;学校;学校   \n",
       "8   B0FFKP838K    教学楼3号(外国语学院)        科教文化服务;学校;高等院校   \n",
       "9   B0FFKSF1FI           香辣螺蛳粉      餐饮服务;餐饮相关场所;餐饮相关   \n",
       "10  B0HGDU8NLD     广州南方学院1号实验楼          科教文化服务;学校;学校   \n",
       "11  B0FFLF90I2    煌上煌酱鸭(南方学院店)          餐饮服务;快餐厅;快餐厅   \n",
       "12  B0HGD58UTU     广州南方学院2号教学楼          科教文化服务;学校;学校   \n",
       "13  B0H25SMRKP       广州南方学院大礼堂      科教文化服务;会展中心;会展中心   \n",
       "14  B0HGDU92JD     广州南方学院教学楼1号          科教文化服务;学校;学校   \n",
       "15  B0HGD592BJ       广州南方学院综合楼          科教文化服务;学校;学校   \n",
       "16  B0FFKP81F0  教学楼1号(文学与传媒学院)  科教文化服务;科教文化场所;科教文化场所   \n",
       "17  B0FFLBEOND          聚贤楼10号           商务住宅;住宅区;宿舍   \n",
       "18  B0FFH6K3U9       广州中大南方招待所    住宿服务;住宿服务相关;住宿服务相关   \n",
       "19  B0HGD58NF8      广州南方学院达人书院  科教文化服务;科教文化场所;科教文化场所   \n",
       "20  B0FFKUVYWV     广州和风庭阿七度假别墅    住宿服务;住宿服务相关;住宿服务相关   \n",
       "21  B0HGDU99RM       广州南方学院图书馆        科教文化服务;图书馆;图书馆   \n",
       "22  B0HGDU92JC     广州南方学院4号实验楼          科教文化服务;学校;学校   \n",
       "23  B0FFL7C054        广州U优森特酒店    住宿服务;住宿服务相关;住宿服务相关   \n",
       "24  B0FFG8CSEK          L5员工宿舍           商务住宅;住宅区;宿舍   \n",
       "25  B0HGD58FR2     广州南方学院教学楼9号          科教文化服务;学校;学校   \n",
       "26  B0HG5Z9JNK     广州南方学院教学楼7号          科教文化服务;学校;学校   \n",
       "27  B0HGD599JM    广州南方学院第11教学楼          科教文化服务;学校;学校   \n",
       "28  B0GUJYPEG2       怒烤烤串(从化店)    餐饮服务;中餐厅;特色/地方风味餐厅   \n",
       "29  B0HGDU6Z41     广州南方学院教学楼6号          科教文化服务;学校;学校   \n",
       "\n",
       "                          tel direction distance              location  \\\n",
       "0   020-87828988;020-61787331         北  470.792  113.679257,23.632577   \n",
       "1                 13622768437        东南  102.617  113.678983,23.627778   \n",
       "2                          []        东南  139.054  113.679358,23.627672   \n",
       "3                          []         北  222.658  113.678490,23.630432   \n",
       "4                 13711245345        东南  231.223  113.680340,23.627566   \n",
       "5                          []         北  242.901  113.677460,23.630490   \n",
       "6                          []        西北  74.1376  113.677941,23.629029   \n",
       "7                          []         北  280.003  113.678211,23.630956   \n",
       "8                          []         北  298.093  113.677247,23.630947   \n",
       "9                 17820061022         西  209.206  113.676231,23.628565   \n",
       "10                         []         北  326.007  113.678215,23.631370   \n",
       "11                13712317721        东北  256.772  113.679965,23.630156   \n",
       "12                         []        西北  346.352  113.677060,23.631346   \n",
       "13                         []        东北   386.65  113.680076,23.631502   \n",
       "14                         []         北  391.548  113.677077,23.631783   \n",
       "15                         []        东北  392.731  113.680117,23.631544   \n",
       "16                         []        西北   393.93  113.676866,23.631736   \n",
       "17                         []        东北   418.51  113.681253,23.631036   \n",
       "18               020-61787222        西北  378.102  113.676330,23.631332   \n",
       "19                         []         北  446.366  113.679041,23.632392   \n",
       "20                         []        东北   424.35  113.681736,23.630569   \n",
       "21  020-61787368;020-61787371         北  489.331  113.679177,23.632762   \n",
       "22                         []         北  498.883  113.679963,23.632652   \n",
       "23                15813395296         北  464.819  113.679226,23.632528   \n",
       "24                         []        东北  554.129  113.682583,23.631487   \n",
       "25                         []         北  532.163  113.679747,23.633032   \n",
       "26                         []         北  544.868  113.678600,23.633330   \n",
       "27                         []         北  556.036  113.680037,23.633173   \n",
       "28                         []         北  510.112  113.677160,23.632910   \n",
       "29                         []         北  586.331  113.678424,23.633710   \n",
       "\n",
       "                          address poiweight businessarea  \n",
       "0                        温泉大道882号  0.450402           []  \n",
       "1               温泉镇乌土村松浪队5号(近博学路)  0.237309           []  \n",
       "2                 从莞深高速(广州南方学院南侧)  0.223065           []  \n",
       "3                            笃行路2  0.157653           []  \n",
       "4                      中大南方学院南门1号  0.256152           []  \n",
       "5                             博学路  0.221662           []  \n",
       "6                   博学路广州南方学院综合楼内   0.17934           []  \n",
       "7                             博学路  0.221662           []  \n",
       "8                           博学路25  0.191742           []  \n",
       "9                     广州南方学院西4123  0.209252           []  \n",
       "10                          博学路附近  0.221662           []  \n",
       "11  笃行路20、22、24号广州南方学院商业中心1层1F015  0.209448           []  \n",
       "12                            博学路  0.191229           []  \n",
       "13                       温泉大道882号  0.261624           []  \n",
       "14                         博学路19号  0.221662           []  \n",
       "15                温泉大道886号广州南方学院内  0.221662           []  \n",
       "16                       博学路19号附近  0.191742           []  \n",
       "17                  从莞深高速(广州南方学院)  0.190963           []  \n",
       "18       温泉镇温泉大道882号广州南方学院H7栋1-5层  0.254885           []  \n",
       "19           温泉大道882号广州南方学院新综合楼2层  0.191229           []  \n",
       "20                          保利桃花源  0.273168           []  \n",
       "21                温泉大道882号广州南方学院内  0.257947           []  \n",
       "22                          博学路附近  0.221662           []  \n",
       "23       温泉镇博学路882号(广州南方学院商业中心1层)  0.317505           []  \n",
       "24                  从莞深高速(广州南方学院)  0.185371           []  \n",
       "25                         广州南方学院  0.221662           []  \n",
       "26                            博学路  0.221553           []  \n",
       "27                 温泉大道882号广州南方学院  0.221662           []  \n",
       "28         温泉大道882号广州南方学院内博学路6号之3  0.216026           []  \n",
       "29                        温泉大道882  0.221662           []  "
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.json_normalize(r.json()['regeocode']['pois'])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3a588720",
   "metadata": {},
   "source": [
    "## 作业：\n",
    "* 尝试搜索POI2.0 接口\n",
    "* 获取中餐厅、西餐厅、快餐厅的信息(图片、内容等)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f42aa959",
   "metadata": {},
   "source": [
    "## 1.关键字搜索"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "b99c46e6",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 1. 调用requests模块（打开一个 google chrome 浏览器）\n",
    "import requests"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "12dee708",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 2.请求方法：GET\n",
    "# 3.请求的关键字搜索url地址：https://restapi.amap.com/v5/place/text?parameters\n",
    "keyword_url = \"https://restapi.amap.com/v5/place/text?parameters\"\n",
    "\n",
    "# 4.请求的参数（payload）\n",
    "payload = {\n",
    "    \"key\":\"091c69bb3b356e0f0eb237e4e7a62a45\",\n",
    "    \"keywords\":\"中餐厅\",\n",
    "    \"city\":\"广州\",\n",
    "    \"extensions\":\"all\",\n",
    "    \"show_fields\":\"photos\"\n",
    "}\n",
    "# 5.发起请求\n",
    "r = requests.get(url=keyword_url,params=payload)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "bf6bc9db",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Response [200]>"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "426095aa",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'status': '1',\n",
       " 'info': 'OK',\n",
       " 'infocode': '10000',\n",
       " 'pois': [{'name': '龙庭琇厨(越华店)',\n",
       "   'id': 'B00141T32F',\n",
       "   'location': '113.267539,23.129697',\n",
       "   'type': '餐饮服务;中餐厅;综合酒楼',\n",
       "   'typecode': '050101',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '越秀区',\n",
       "   'address': '越华路112号珠江国际大厦4层',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440104',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/51fecd5e3c116b1226d5a6690cf2f705'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/16160e98c1da90ef02b2a49217928747'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/bc3054ee26e63378fa649f0ef34ddc51'}]},\n",
       "  {'name': '牛一方潮汕牛肉(越华路店)',\n",
       "   'id': 'B0FFHUOWI8',\n",
       "   'location': '113.266641,23.129317',\n",
       "   'type': '餐饮服务;中餐厅;火锅店',\n",
       "   'typecode': '050117',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '越秀区',\n",
       "   'address': '越华路116号雅兰酒店旁(区政府对面)',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440104',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/eaafd2d27154b46329d7d2ca5d7d5152'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/0c07d3de925fe6c258efc2f8f620974a'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/138176bebcff253d5dc959e541aaa094'}]},\n",
       "  {'name': '又一间茶点轩(中山五店)',\n",
       "   'id': 'B0FFFPA1ZV',\n",
       "   'location': '113.263678,23.125199',\n",
       "   'type': '餐饮服务;快餐厅;茶餐厅',\n",
       "   'typecode': '050305',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '越秀区',\n",
       "   'address': '中山五路193-215号百汇广场4楼(近广发银行)',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440104',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/92a4b9dbde8bc6b58146d2c85a883de9'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/9f5ea18d1493733479abea7aa8a46f39'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/d6d3225843ce1bbdd8bd4e4be87bd0bf'}]},\n",
       "  {'name': '大龙焱火锅(五月花商业广场店)',\n",
       "   'id': 'B0FFGLLL9W',\n",
       "   'location': '113.266588,23.125785',\n",
       "   'type': '餐饮服务;中餐厅;火锅店',\n",
       "   'typecode': '050117',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '越秀区',\n",
       "   'address': '中山五路68号4层407-409、428-429、435-436',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440104',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/15c29d90e0e1a66e7159571bd14712b6'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/58aac700f71be67434708b3ba03b739f'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/513de5881870476d9e5c9e943ff95ed6'}]},\n",
       "  {'name': '翠华餐厅(广州捷登店)',\n",
       "   'id': 'B0FFGPB6H4',\n",
       "   'location': '113.265709,23.125776',\n",
       "   'type': '餐饮服务;中餐厅;中餐厅',\n",
       "   'typecode': '050100',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '越秀区',\n",
       "   'address': '中山五路70号捷登都会五楼L5007',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440104',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/eb0a347eddd71b29253deedfee5d2d4e'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/00d3150988bdc1ab3d69dca14cb6b29c'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/02970d101c41bf1116f3c67b394e5599'}]},\n",
       "  {'name': '胜安饭店(东风中路)',\n",
       "   'id': 'B0014021E7',\n",
       "   'location': '113.269168,23.131421',\n",
       "   'type': '餐饮服务;中餐厅;中餐厅',\n",
       "   'typecode': '050100',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '越秀区',\n",
       "   'address': '东风中路331号德源里1号',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440104',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/0c091432ab387ccc89083a0078166596'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/178f80742a3ade9971fccdeed4c4b7e8'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/55acb625a310a084c90f0704'}]},\n",
       "  {'name': '甘思咪哚云南艺术餐厅(越秀店)',\n",
       "   'id': 'B0FFGIQZF4',\n",
       "   'location': '113.265922,23.125913',\n",
       "   'type': '餐饮服务;中餐厅;云贵菜',\n",
       "   'typecode': '050114',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '越秀区',\n",
       "   'address': '中山五路70号捷登都会5层L5001室',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440104',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/598e336f3508eaa120a3b3fd72fe2080'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/00ecaeadf9e9db67b07e93e5d70d0f75'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/0339f042e9afb157722190f67cac0c92'}]},\n",
       "  {'name': '银记肠粉店(百灵分店)',\n",
       "   'id': 'B00140ASNP',\n",
       "   'location': '113.260000,23.130781',\n",
       "   'type': '餐饮服务;中餐厅;中餐厅',\n",
       "   'typecode': '050100',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '越秀区',\n",
       "   'address': '百灵路86号(近市一医院)',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440104',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/5de91a56b01dc1e6018a98dd1fa99bcf'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/dc80866e3a36f88105f32c26c4df1ccd'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/1dafcd9dcaf41403cea1b84956e7cbd0'}]},\n",
       "  {'name': '桂林米粉(越华路店)',\n",
       "   'id': 'B00140JH28',\n",
       "   'location': '113.267006,23.129289',\n",
       "   'type': '餐饮服务;中餐厅;特色/地方风味餐厅',\n",
       "   'typecode': '050118',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '越秀区',\n",
       "   'address': '越华路116号首层之六铺',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440104',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/34d1d52a2eda931dabd55c3f1d8e4147'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/56c570f1a310218d5b5058b0'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/06c7ce25f55c5dcfe0f5873c34770a57'}]},\n",
       "  {'name': '皇上皇(北京路店)',\n",
       "   'id': 'B0FFF3MA53',\n",
       "   'location': '113.268963,23.126406',\n",
       "   'type': '餐饮服务;中餐厅;中餐厅',\n",
       "   'typecode': '050100',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '越秀区',\n",
       "   'address': '北京路322号步行街1层',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440104',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/1a6cfbb14b72f98f04cecbcc2ebf4f12'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/3331673c6bb88871bc35cd831bfb6f73'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/56a9ea19a310218d5b463fd7'}]}],\n",
       " 'count': '10'}"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "fddc3637",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "734c6e9e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>id</th>\n",
       "      <th>location</th>\n",
       "      <th>type</th>\n",
       "      <th>typecode</th>\n",
       "      <th>pname</th>\n",
       "      <th>cityname</th>\n",
       "      <th>adname</th>\n",
       "      <th>address</th>\n",
       "      <th>pcode</th>\n",
       "      <th>citycode</th>\n",
       "      <th>adcode</th>\n",
       "      <th>photos</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>龙庭琇厨(越华店)</td>\n",
       "      <td>B00141T32F</td>\n",
       "      <td>113.267539,23.129697</td>\n",
       "      <td>餐饮服务;中餐厅;综合酒楼</td>\n",
       "      <td>050101</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>越秀区</td>\n",
       "      <td>越华路112号珠江国际大厦4层</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440104</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>牛一方潮汕牛肉(越华路店)</td>\n",
       "      <td>B0FFHUOWI8</td>\n",
       "      <td>113.266641,23.129317</td>\n",
       "      <td>餐饮服务;中餐厅;火锅店</td>\n",
       "      <td>050117</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>越秀区</td>\n",
       "      <td>越华路116号雅兰酒店旁(区政府对面)</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440104</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>又一间茶点轩(中山五店)</td>\n",
       "      <td>B0FFFPA1ZV</td>\n",
       "      <td>113.263678,23.125199</td>\n",
       "      <td>餐饮服务;快餐厅;茶餐厅</td>\n",
       "      <td>050305</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>越秀区</td>\n",
       "      <td>中山五路193-215号百汇广场4楼(近广发银行)</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440104</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>大龙焱火锅(五月花商业广场店)</td>\n",
       "      <td>B0FFGLLL9W</td>\n",
       "      <td>113.266588,23.125785</td>\n",
       "      <td>餐饮服务;中餐厅;火锅店</td>\n",
       "      <td>050117</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>越秀区</td>\n",
       "      <td>中山五路68号4层407-409、428-429、435-436</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440104</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>翠华餐厅(广州捷登店)</td>\n",
       "      <td>B0FFGPB6H4</td>\n",
       "      <td>113.265709,23.125776</td>\n",
       "      <td>餐饮服务;中餐厅;中餐厅</td>\n",
       "      <td>050100</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>越秀区</td>\n",
       "      <td>中山五路70号捷登都会五楼L5007</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440104</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>胜安饭店(东风中路)</td>\n",
       "      <td>B0014021E7</td>\n",
       "      <td>113.269168,23.131421</td>\n",
       "      <td>餐饮服务;中餐厅;中餐厅</td>\n",
       "      <td>050100</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>越秀区</td>\n",
       "      <td>东风中路331号德源里1号</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440104</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>甘思咪哚云南艺术餐厅(越秀店)</td>\n",
       "      <td>B0FFGIQZF4</td>\n",
       "      <td>113.265922,23.125913</td>\n",
       "      <td>餐饮服务;中餐厅;云贵菜</td>\n",
       "      <td>050114</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>越秀区</td>\n",
       "      <td>中山五路70号捷登都会5层L5001室</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440104</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>银记肠粉店(百灵分店)</td>\n",
       "      <td>B00140ASNP</td>\n",
       "      <td>113.260000,23.130781</td>\n",
       "      <td>餐饮服务;中餐厅;中餐厅</td>\n",
       "      <td>050100</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>越秀区</td>\n",
       "      <td>百灵路86号(近市一医院)</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440104</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>桂林米粉(越华路店)</td>\n",
       "      <td>B00140JH28</td>\n",
       "      <td>113.267006,23.129289</td>\n",
       "      <td>餐饮服务;中餐厅;特色/地方风味餐厅</td>\n",
       "      <td>050118</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>越秀区</td>\n",
       "      <td>越华路116号首层之六铺</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440104</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>皇上皇(北京路店)</td>\n",
       "      <td>B0FFF3MA53</td>\n",
       "      <td>113.268963,23.126406</td>\n",
       "      <td>餐饮服务;中餐厅;中餐厅</td>\n",
       "      <td>050100</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>越秀区</td>\n",
       "      <td>北京路322号步行街1层</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440104</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "              name          id              location                type  \\\n",
       "0        龙庭琇厨(越华店)  B00141T32F  113.267539,23.129697       餐饮服务;中餐厅;综合酒楼   \n",
       "1    牛一方潮汕牛肉(越华路店)  B0FFHUOWI8  113.266641,23.129317        餐饮服务;中餐厅;火锅店   \n",
       "2     又一间茶点轩(中山五店)  B0FFFPA1ZV  113.263678,23.125199        餐饮服务;快餐厅;茶餐厅   \n",
       "3  大龙焱火锅(五月花商业广场店)  B0FFGLLL9W  113.266588,23.125785        餐饮服务;中餐厅;火锅店   \n",
       "4      翠华餐厅(广州捷登店)  B0FFGPB6H4  113.265709,23.125776        餐饮服务;中餐厅;中餐厅   \n",
       "5       胜安饭店(东风中路)  B0014021E7  113.269168,23.131421        餐饮服务;中餐厅;中餐厅   \n",
       "6  甘思咪哚云南艺术餐厅(越秀店)  B0FFGIQZF4  113.265922,23.125913        餐饮服务;中餐厅;云贵菜   \n",
       "7      银记肠粉店(百灵分店)  B00140ASNP  113.260000,23.130781        餐饮服务;中餐厅;中餐厅   \n",
       "8       桂林米粉(越华路店)  B00140JH28  113.267006,23.129289  餐饮服务;中餐厅;特色/地方风味餐厅   \n",
       "9        皇上皇(北京路店)  B0FFF3MA53  113.268963,23.126406        餐饮服务;中餐厅;中餐厅   \n",
       "\n",
       "  typecode pname cityname adname                           address   pcode  \\\n",
       "0   050101   广东省      广州市    越秀区                   越华路112号珠江国际大厦4层  440000   \n",
       "1   050117   广东省      广州市    越秀区               越华路116号雅兰酒店旁(区政府对面)  440000   \n",
       "2   050305   广东省      广州市    越秀区         中山五路193-215号百汇广场4楼(近广发银行)  440000   \n",
       "3   050117   广东省      广州市    越秀区  中山五路68号4层407-409、428-429、435-436  440000   \n",
       "4   050100   广东省      广州市    越秀区                中山五路70号捷登都会五楼L5007  440000   \n",
       "5   050100   广东省      广州市    越秀区                     东风中路331号德源里1号  440000   \n",
       "6   050114   广东省      广州市    越秀区               中山五路70号捷登都会5层L5001室  440000   \n",
       "7   050100   广东省      广州市    越秀区                     百灵路86号(近市一医院)  440000   \n",
       "8   050118   广东省      广州市    越秀区                      越华路116号首层之六铺  440000   \n",
       "9   050100   广东省      广州市    越秀区                      北京路322号步行街1层  440000   \n",
       "\n",
       "  citycode  adcode                                             photos  \n",
       "0      020  440104  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "1      020  440104  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "2      020  440104  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "3      020  440104  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "4      020  440104  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "5      020  440104  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "6      020  440104  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "7      020  440104  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "8      020  440104  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "9      020  440104  [{'title': '', 'url': 'http://store.is.autonav...  "
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.json_normalize(r.json()['pois'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "3eb9a5b5",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 2.请求方法：GET\n",
    "# 3.请求的关键字搜索url地址：https://restapi.amap.com/v5/place/text?parameters\n",
    "keyword_url = \"https://restapi.amap.com/v5/place/text?parameters\"\n",
    "\n",
    "# 4.请求的参数（payload）\n",
    "payload = {\n",
    "    \"key\":\"091c69bb3b356e0f0eb237e4e7a62a45\",\n",
    "    \"keywords\":\"西餐厅\",\n",
    "    \"city\":\"广州\",\n",
    "    \"extensions\":\"all\",\n",
    "    \"show_fields\":\"photos\"\n",
    "}\n",
    "# 5.发起请求\n",
    "r = requests.get(url=keyword_url,params=payload)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "f9728130",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'status': '1',\n",
       " 'info': 'OK',\n",
       " 'infocode': '10000',\n",
       " 'pois': [{'name': 'blues restaurant布鲁斯西餐厅',\n",
       "   'id': 'B0HG05Y8ZQ',\n",
       "   'location': '113.268380,23.125761',\n",
       "   'type': '餐饮服务;快餐厅;快餐厅',\n",
       "   'typecode': '050300',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '越秀区',\n",
       "   'address': '中山五路6号2、3层(北京路新大新商场正门旁)',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440104',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/208c2c0ae38a58838bddeb64f69d2e91'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/0493ea76a6b0dc8e9800e713b60adaf8'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/07cf9eb530c67e64d09ccc8dbcebbeae'}]},\n",
       "  {'name': '君洋牛排(五月花店)',\n",
       "   'id': 'B0HKCM35FR',\n",
       "   'location': '113.266939,23.125871',\n",
       "   'type': '餐饮服务;外国餐厅;西餐厅(综合风味)',\n",
       "   'typecode': '050201',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '越秀区',\n",
       "   'address': '五月花商业广场4楼(公园前地铁站出入口步行90米)',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440104',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/28f14110716dfc4c4e73e47d0232f17b'}]},\n",
       "  {'name': '太平馆(北京路店)',\n",
       "   'id': 'B0FFJYCSTV',\n",
       "   'location': '113.268949,23.126209',\n",
       "   'type': '餐饮服务;外国餐厅;西餐厅(综合风味)',\n",
       "   'typecode': '050201',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '越秀区',\n",
       "   'address': '北京路342号(公园前地铁站出入口步行240米)',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440104',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/fcf187703d4d44d9b2499d891bc25e81'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/ab4285b44d3f543aa84e7482046c7bc0'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/4fe4977fa7a509e70a5232648b4d678c'}]},\n",
       "  {'name': '1928音乐餐吧(五月花店)',\n",
       "   'id': 'B0FFF0FKTH',\n",
       "   'location': '113.266728,23.125756',\n",
       "   'type': '餐饮服务;外国餐厅;法式菜品餐厅',\n",
       "   'typecode': '050204',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '越秀区',\n",
       "   'address': '中山五路68号五月花商业广场4楼',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440104',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/48a031fc27a6bb9b4c4499c1c0224dd8'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/04b56f9e802e269f0f995d7edea395db'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/06609b5c28e9bca5fbc246b579edb8bc'}]},\n",
       "  {'name': '萨莉亚意式餐厅(165五月花广场店)',\n",
       "   'id': 'B0G2XGJL5Q',\n",
       "   'location': '113.267023,23.125886',\n",
       "   'type': '餐饮服务;外国餐厅;意式菜品餐厅',\n",
       "   'typecode': '050205',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '越秀区',\n",
       "   'address': '中山五路68号五月花商业广场B1',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440104',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/59bcdd0b2f06f43c55eb9f332325c06f'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/67075659bfa4589cba6c9487ce6f6596'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/b04152aa9479bc07a598195ac79442ec'}]},\n",
       "  {'name': '聚谊阁西餐厅',\n",
       "   'id': 'B0FFFZD6YX',\n",
       "   'location': '113.269414,23.128872',\n",
       "   'type': '餐饮服务;外国餐厅;西餐厅(综合风味)',\n",
       "   'typecode': '050201',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '越秀区',\n",
       "   'address': '北京路374号广州大厦3楼',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440104',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/c0cd86e3c8357991a15958a836f64176'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/455b7cfb4b33f784087b3833ad8e6b6b'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/ab521281474a735997a6260380c4d5aa'}]},\n",
       "  {'name': '牛一安格斯牛扒',\n",
       "   'id': 'B0I63UZKVF',\n",
       "   'location': '113.262729,23.128861',\n",
       "   'type': '餐饮服务;外国餐厅;牛扒店(扒房)',\n",
       "   'typecode': '050211',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '越秀区',\n",
       "   'address': '北京街道街府前路15号',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440104'},\n",
       "  {'name': '转角遇到爱休闲餐厅(广州起义路)',\n",
       "   'id': 'B0FFFPA2J2',\n",
       "   'location': '113.264023,23.123793',\n",
       "   'type': '餐饮服务;中餐厅;中餐厅|餐饮服务;休闲餐饮场所;休闲餐饮场所',\n",
       "   'typecode': '050100|050400',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '越秀区',\n",
       "   'address': '起义路253号2-4层(公园前地铁站J口步行110米)',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440104',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/4d8f4ec3577b15162035f773d5a013be'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/559a3e55a310b38d66d3745f'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/56a9e928a310218d5b4614c8'}]},\n",
       "  {'name': '大家点(中山四路店)',\n",
       "   'id': 'B0FFG2M704',\n",
       "   'location': '113.270877,23.125499',\n",
       "   'type': '餐饮服务;中餐厅;广东菜(粤菜)|餐饮服务;中餐厅;海鲜酒楼',\n",
       "   'typecode': '050103|050119',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '越秀区',\n",
       "   'address': '中山四路333号,335号万方字画批发商都五楼(北京路步行街50米)',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440104',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/2e5c865dad8449231a0745abefde74d7'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/ab5afc1a5af7630f7cba8c12bd1b1c1d'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/56c5703ca310218d5b503f38'}]},\n",
       "  {'name': '蜜荟西餐',\n",
       "   'id': 'B0H2RZ3XID',\n",
       "   'location': '113.258857,23.125932',\n",
       "   'type': '餐饮服务;外国餐厅;西餐厅(综合风味)',\n",
       "   'typecode': '050201',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '越秀区',\n",
       "   'address': '惠吉西一坊10号(西门口地铁站B口步行380米)',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440104',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/5b9093b91a8cd80ee122a57a183fa8c6'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/6e22b20dc2e05be4ca6c7bd9d6c4397d'}]}],\n",
       " 'count': '10'}"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "c71af90e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>id</th>\n",
       "      <th>location</th>\n",
       "      <th>type</th>\n",
       "      <th>typecode</th>\n",
       "      <th>pname</th>\n",
       "      <th>cityname</th>\n",
       "      <th>adname</th>\n",
       "      <th>address</th>\n",
       "      <th>pcode</th>\n",
       "      <th>citycode</th>\n",
       "      <th>adcode</th>\n",
       "      <th>photos</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>blues restaurant布鲁斯西餐厅</td>\n",
       "      <td>B0HG05Y8ZQ</td>\n",
       "      <td>113.268380,23.125761</td>\n",
       "      <td>餐饮服务;快餐厅;快餐厅</td>\n",
       "      <td>050300</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>越秀区</td>\n",
       "      <td>中山五路6号2、3层(北京路新大新商场正门旁)</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440104</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>君洋牛排(五月花店)</td>\n",
       "      <td>B0HKCM35FR</td>\n",
       "      <td>113.266939,23.125871</td>\n",
       "      <td>餐饮服务;外国餐厅;西餐厅(综合风味)</td>\n",
       "      <td>050201</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>越秀区</td>\n",
       "      <td>五月花商业广场4楼(公园前地铁站出入口步行90米)</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440104</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>太平馆(北京路店)</td>\n",
       "      <td>B0FFJYCSTV</td>\n",
       "      <td>113.268949,23.126209</td>\n",
       "      <td>餐饮服务;外国餐厅;西餐厅(综合风味)</td>\n",
       "      <td>050201</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>越秀区</td>\n",
       "      <td>北京路342号(公园前地铁站出入口步行240米)</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440104</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1928音乐餐吧(五月花店)</td>\n",
       "      <td>B0FFF0FKTH</td>\n",
       "      <td>113.266728,23.125756</td>\n",
       "      <td>餐饮服务;外国餐厅;法式菜品餐厅</td>\n",
       "      <td>050204</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>越秀区</td>\n",
       "      <td>中山五路68号五月花商业广场4楼</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440104</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>萨莉亚意式餐厅(165五月花广场店)</td>\n",
       "      <td>B0G2XGJL5Q</td>\n",
       "      <td>113.267023,23.125886</td>\n",
       "      <td>餐饮服务;外国餐厅;意式菜品餐厅</td>\n",
       "      <td>050205</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>越秀区</td>\n",
       "      <td>中山五路68号五月花商业广场B1</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440104</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>聚谊阁西餐厅</td>\n",
       "      <td>B0FFFZD6YX</td>\n",
       "      <td>113.269414,23.128872</td>\n",
       "      <td>餐饮服务;外国餐厅;西餐厅(综合风味)</td>\n",
       "      <td>050201</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>越秀区</td>\n",
       "      <td>北京路374号广州大厦3楼</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440104</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>牛一安格斯牛扒</td>\n",
       "      <td>B0I63UZKVF</td>\n",
       "      <td>113.262729,23.128861</td>\n",
       "      <td>餐饮服务;外国餐厅;牛扒店(扒房)</td>\n",
       "      <td>050211</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>越秀区</td>\n",
       "      <td>北京街道街府前路15号</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440104</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>转角遇到爱休闲餐厅(广州起义路)</td>\n",
       "      <td>B0FFFPA2J2</td>\n",
       "      <td>113.264023,23.123793</td>\n",
       "      <td>餐饮服务;中餐厅;中餐厅|餐饮服务;休闲餐饮场所;休闲餐饮场所</td>\n",
       "      <td>050100|050400</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>越秀区</td>\n",
       "      <td>起义路253号2-4层(公园前地铁站J口步行110米)</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440104</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>大家点(中山四路店)</td>\n",
       "      <td>B0FFG2M704</td>\n",
       "      <td>113.270877,23.125499</td>\n",
       "      <td>餐饮服务;中餐厅;广东菜(粤菜)|餐饮服务;中餐厅;海鲜酒楼</td>\n",
       "      <td>050103|050119</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>越秀区</td>\n",
       "      <td>中山四路333号,335号万方字画批发商都五楼(北京路步行街50米)</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440104</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>蜜荟西餐</td>\n",
       "      <td>B0H2RZ3XID</td>\n",
       "      <td>113.258857,23.125932</td>\n",
       "      <td>餐饮服务;外国餐厅;西餐厅(综合风味)</td>\n",
       "      <td>050201</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>越秀区</td>\n",
       "      <td>惠吉西一坊10号(西门口地铁站B口步行380米)</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440104</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                     name          id              location  \\\n",
       "0  blues restaurant布鲁斯西餐厅  B0HG05Y8ZQ  113.268380,23.125761   \n",
       "1              君洋牛排(五月花店)  B0HKCM35FR  113.266939,23.125871   \n",
       "2               太平馆(北京路店)  B0FFJYCSTV  113.268949,23.126209   \n",
       "3          1928音乐餐吧(五月花店)  B0FFF0FKTH  113.266728,23.125756   \n",
       "4      萨莉亚意式餐厅(165五月花广场店)  B0G2XGJL5Q  113.267023,23.125886   \n",
       "5                  聚谊阁西餐厅  B0FFFZD6YX  113.269414,23.128872   \n",
       "6                 牛一安格斯牛扒  B0I63UZKVF  113.262729,23.128861   \n",
       "7        转角遇到爱休闲餐厅(广州起义路)  B0FFFPA2J2  113.264023,23.123793   \n",
       "8              大家点(中山四路店)  B0FFG2M704  113.270877,23.125499   \n",
       "9                    蜜荟西餐  B0H2RZ3XID  113.258857,23.125932   \n",
       "\n",
       "                              type       typecode pname cityname adname  \\\n",
       "0                     餐饮服务;快餐厅;快餐厅         050300   广东省      广州市    越秀区   \n",
       "1              餐饮服务;外国餐厅;西餐厅(综合风味)         050201   广东省      广州市    越秀区   \n",
       "2              餐饮服务;外国餐厅;西餐厅(综合风味)         050201   广东省      广州市    越秀区   \n",
       "3                 餐饮服务;外国餐厅;法式菜品餐厅         050204   广东省      广州市    越秀区   \n",
       "4                 餐饮服务;外国餐厅;意式菜品餐厅         050205   广东省      广州市    越秀区   \n",
       "5              餐饮服务;外国餐厅;西餐厅(综合风味)         050201   广东省      广州市    越秀区   \n",
       "6                餐饮服务;外国餐厅;牛扒店(扒房)         050211   广东省      广州市    越秀区   \n",
       "7  餐饮服务;中餐厅;中餐厅|餐饮服务;休闲餐饮场所;休闲餐饮场所  050100|050400   广东省      广州市    越秀区   \n",
       "8   餐饮服务;中餐厅;广东菜(粤菜)|餐饮服务;中餐厅;海鲜酒楼  050103|050119   广东省      广州市    越秀区   \n",
       "9              餐饮服务;外国餐厅;西餐厅(综合风味)         050201   广东省      广州市    越秀区   \n",
       "\n",
       "                              address   pcode citycode  adcode  \\\n",
       "0             中山五路6号2、3层(北京路新大新商场正门旁)  440000      020  440104   \n",
       "1           五月花商业广场4楼(公园前地铁站出入口步行90米)  440000      020  440104   \n",
       "2            北京路342号(公园前地铁站出入口步行240米)  440000      020  440104   \n",
       "3                    中山五路68号五月花商业广场4楼  440000      020  440104   \n",
       "4                    中山五路68号五月花商业广场B1  440000      020  440104   \n",
       "5                       北京路374号广州大厦3楼  440000      020  440104   \n",
       "6                         北京街道街府前路15号  440000      020  440104   \n",
       "7         起义路253号2-4层(公园前地铁站J口步行110米)  440000      020  440104   \n",
       "8  中山四路333号,335号万方字画批发商都五楼(北京路步行街50米)  440000      020  440104   \n",
       "9            惠吉西一坊10号(西门口地铁站B口步行380米)  440000      020  440104   \n",
       "\n",
       "                                              photos  \n",
       "0  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "1  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "2  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "3  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "4  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "5  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "6                                                NaN  \n",
       "7  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "8  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "9  [{'title': '', 'url': 'http://store.is.autonav...  "
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.json_normalize(r.json()['pois'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "52efa391",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 2.请求方法：GET\n",
    "# 3.请求的关键字搜索url地址：https://restapi.amap.com/v5/place/text?parameters\n",
    "keyword_url = \"https://restapi.amap.com/v5/place/text?parameters\"\n",
    "\n",
    "# 4.请求的参数（payload）\n",
    "payload = {\n",
    "    \"key\":\"091c69bb3b356e0f0eb237e4e7a62a45\",\n",
    "    \"keywords\":\"快餐厅\",\n",
    "    \"city\":\"广州\",\n",
    "    \"extensions\":\"all\",\n",
    "    \"show_fields\":\"photos\"\n",
    "}\n",
    "# 5.发起请求\n",
    "r = requests.get(url=keyword_url,params=payload)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "1ef6e0ed",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'status': '1',\n",
       " 'info': 'OK',\n",
       " 'infocode': '10000',\n",
       " 'pois': [{'name': '赛百味(交易广场店)',\n",
       "   'id': 'B00140T179',\n",
       "   'location': '113.263146,23.131008',\n",
       "   'type': '餐饮服务;快餐厅;快餐厅',\n",
       "   'typecode': '050300',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '越秀区',\n",
       "   'address': '东风中路268号交易广场首层112-113',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440104',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/2ad6fd1bec5a14a3c1f6f9a3527c5c33'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/0a1775684dccc42baa063a7ae8b75390'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/fa95c3158050fe57157a311bfb9bfd9e'}]},\n",
       "  {'name': '西华美食品(百灵路店)',\n",
       "   'id': 'B00140CIPE',\n",
       "   'location': '113.261307,23.130732',\n",
       "   'type': '餐饮服务;餐饮相关场所;餐饮相关',\n",
       "   'typecode': '050000',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '越秀区',\n",
       "   'address': '百灵路17号(御东雅苑销售中心正对面)',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440104',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/3449e3841f3ed8d4535baa5abb93f28b'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/1250f2c0c2bedc554a0a0da62c95322b'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/3b2680cfc0c1723a8b2e818182c7198a'}]},\n",
       "  {'name': '赛百味(动漫星城店)',\n",
       "   'id': 'B00140UEQJ',\n",
       "   'location': '113.264985,23.125752',\n",
       "   'type': '餐饮服务;快餐厅;快餐厅',\n",
       "   'typecode': '050300',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '越秀区',\n",
       "   'address': '吉祥路1号广州动漫星城广场负一层W1A007铺',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440104',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/2ad6fd1bec5a14a3c1f6f9a3527c5c33'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/72ecfbf978290669fd68d51c2ab68ffa'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/892a392890f72fdd23535cf6be3932f7'}]},\n",
       "  {'name': '桂林米粉(越华路店)',\n",
       "   'id': 'B00140JH28',\n",
       "   'location': '113.267006,23.129289',\n",
       "   'type': '餐饮服务;中餐厅;特色/地方风味餐厅',\n",
       "   'typecode': '050118',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '越秀区',\n",
       "   'address': '越华路116号首层之六铺',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440104',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/34d1d52a2eda931dabd55c3f1d8e4147'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/56c570f1a310218d5b5058b0'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/06c7ce25f55c5dcfe0f5873c34770a57'}]},\n",
       "  {'name': '银记肠粉店(百灵分店)',\n",
       "   'id': 'B00140ASNP',\n",
       "   'location': '113.260000,23.130781',\n",
       "   'type': '餐饮服务;中餐厅;中餐厅',\n",
       "   'typecode': '050100',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '越秀区',\n",
       "   'address': '百灵路86号(近市一医院)',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440104',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/5de91a56b01dc1e6018a98dd1fa99bcf'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/dc80866e3a36f88105f32c26c4df1ccd'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/1dafcd9dcaf41403cea1b84956e7cbd0'}]},\n",
       "  {'name': '俏凤凰苗家牛肉粉(动漫星城店)',\n",
       "   'id': 'B0FFILXPZ9',\n",
       "   'location': '113.263817,23.125800',\n",
       "   'type': '餐饮服务;中餐厅;中餐厅',\n",
       "   'typecode': '050100',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '越秀区',\n",
       "   'address': '吉祥路1号B202自编W2A001-006号商铺动漫星城',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440104',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/b2c8b12cf37ce4a0b61b0f229b27a8e4'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/12cb0413b775ea4de81e473c4a193bb5'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/1a07b15eba4f20b69783ee1746d5e497'}]},\n",
       "  {'name': 'ThePizzaFactory披萨工坊(捷登都会店)',\n",
       "   'id': 'B0FFIG83S8',\n",
       "   'location': '113.265827,23.125984',\n",
       "   'type': '餐饮服务;快餐厅;快餐厅',\n",
       "   'typecode': '050300',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '越秀区',\n",
       "   'address': '中山五路70号捷登都会F5',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440104',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/a69ada189dbec8d5f053f40881ff34c0'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/07e7a7ec11078e133245cd7a4b920d56'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/228d037db73857ea279cd27f946776c7'}]},\n",
       "  {'name': '大可以肠粉店(六榕店)',\n",
       "   'id': 'B00140B9V0',\n",
       "   'location': '113.260611,23.126967',\n",
       "   'type': '餐饮服务;中餐厅;中餐厅',\n",
       "   'typecode': '050100',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '越秀区',\n",
       "   'address': '六榕街(公园前地铁站I2口步行430米)',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440104',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/a8c29855b3adaca0f951063ca81e1c8e'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/213b1802ca9169ff283240e6fca3433d'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/6e866d99a46404140a3787b0ef68491e'}]},\n",
       "  {'name': '皇上皇(北京路店)',\n",
       "   'id': 'B0FFF3MA53',\n",
       "   'location': '113.268963,23.126406',\n",
       "   'type': '餐饮服务;中餐厅;中餐厅',\n",
       "   'typecode': '050100',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '越秀区',\n",
       "   'address': '北京路322号步行街1层',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440104',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/1a6cfbb14b72f98f04cecbcc2ebf4f12'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/3331673c6bb88871bc35cd831bfb6f73'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/56a9ea19a310218d5b463fd7'}]},\n",
       "  {'name': '都城快餐(广大店)',\n",
       "   'id': 'B00141RHE0',\n",
       "   'location': '113.267674,23.126282',\n",
       "   'type': '餐饮服务;快餐厅;快餐厅',\n",
       "   'typecode': '050300',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '越秀区',\n",
       "   'address': '广大路24号首层(公园前地铁站出入口步行120米)',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440104',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/cf45db79cd452a65d310b2fd2bd03e4d'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/0e266f80bede1e44d29f2e44bcdeeecf'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/00749fa1b3c59e022a823d475284052c'}]}],\n",
       " 'count': '10'}"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "17c84cbb",
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>id</th>\n",
       "      <th>location</th>\n",
       "      <th>type</th>\n",
       "      <th>typecode</th>\n",
       "      <th>pname</th>\n",
       "      <th>cityname</th>\n",
       "      <th>adname</th>\n",
       "      <th>address</th>\n",
       "      <th>pcode</th>\n",
       "      <th>citycode</th>\n",
       "      <th>adcode</th>\n",
       "      <th>photos</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>blues restaurant布鲁斯西餐厅</td>\n",
       "      <td>B0HG05Y8ZQ</td>\n",
       "      <td>113.268380,23.125761</td>\n",
       "      <td>餐饮服务;快餐厅;快餐厅</td>\n",
       "      <td>050300</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>越秀区</td>\n",
       "      <td>中山五路6号2、3层(北京路新大新商场正门旁)</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440104</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>君洋牛排(五月花店)</td>\n",
       "      <td>B0HKCM35FR</td>\n",
       "      <td>113.266939,23.125871</td>\n",
       "      <td>餐饮服务;外国餐厅;西餐厅(综合风味)</td>\n",
       "      <td>050201</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>越秀区</td>\n",
       "      <td>五月花商业广场4楼(公园前地铁站出入口步行90米)</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440104</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>太平馆(北京路店)</td>\n",
       "      <td>B0FFJYCSTV</td>\n",
       "      <td>113.268949,23.126209</td>\n",
       "      <td>餐饮服务;外国餐厅;西餐厅(综合风味)</td>\n",
       "      <td>050201</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>越秀区</td>\n",
       "      <td>北京路342号(公园前地铁站出入口步行240米)</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440104</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1928音乐餐吧(五月花店)</td>\n",
       "      <td>B0FFF0FKTH</td>\n",
       "      <td>113.266728,23.125756</td>\n",
       "      <td>餐饮服务;外国餐厅;法式菜品餐厅</td>\n",
       "      <td>050204</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>越秀区</td>\n",
       "      <td>中山五路68号五月花商业广场4楼</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440104</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>萨莉亚意式餐厅(165五月花广场店)</td>\n",
       "      <td>B0G2XGJL5Q</td>\n",
       "      <td>113.267023,23.125886</td>\n",
       "      <td>餐饮服务;外国餐厅;意式菜品餐厅</td>\n",
       "      <td>050205</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>越秀区</td>\n",
       "      <td>中山五路68号五月花商业广场B1</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440104</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>聚谊阁西餐厅</td>\n",
       "      <td>B0FFFZD6YX</td>\n",
       "      <td>113.269414,23.128872</td>\n",
       "      <td>餐饮服务;外国餐厅;西餐厅(综合风味)</td>\n",
       "      <td>050201</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>越秀区</td>\n",
       "      <td>北京路374号广州大厦3楼</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440104</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>牛一安格斯牛扒</td>\n",
       "      <td>B0I63UZKVF</td>\n",
       "      <td>113.262729,23.128861</td>\n",
       "      <td>餐饮服务;外国餐厅;牛扒店(扒房)</td>\n",
       "      <td>050211</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>越秀区</td>\n",
       "      <td>北京街道街府前路15号</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440104</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>转角遇到爱休闲餐厅(广州起义路)</td>\n",
       "      <td>B0FFFPA2J2</td>\n",
       "      <td>113.264023,23.123793</td>\n",
       "      <td>餐饮服务;中餐厅;中餐厅|餐饮服务;休闲餐饮场所;休闲餐饮场所</td>\n",
       "      <td>050100|050400</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>越秀区</td>\n",
       "      <td>起义路253号2-4层(公园前地铁站J口步行110米)</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440104</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>大家点(中山四路店)</td>\n",
       "      <td>B0FFG2M704</td>\n",
       "      <td>113.270877,23.125499</td>\n",
       "      <td>餐饮服务;中餐厅;广东菜(粤菜)|餐饮服务;中餐厅;海鲜酒楼</td>\n",
       "      <td>050103|050119</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>越秀区</td>\n",
       "      <td>中山四路333号,335号万方字画批发商都五楼(北京路步行街50米)</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440104</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>蜜荟西餐</td>\n",
       "      <td>B0H2RZ3XID</td>\n",
       "      <td>113.258857,23.125932</td>\n",
       "      <td>餐饮服务;外国餐厅;西餐厅(综合风味)</td>\n",
       "      <td>050201</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>越秀区</td>\n",
       "      <td>惠吉西一坊10号(西门口地铁站B口步行380米)</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440104</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                     name          id              location  \\\n",
       "0  blues restaurant布鲁斯西餐厅  B0HG05Y8ZQ  113.268380,23.125761   \n",
       "1              君洋牛排(五月花店)  B0HKCM35FR  113.266939,23.125871   \n",
       "2               太平馆(北京路店)  B0FFJYCSTV  113.268949,23.126209   \n",
       "3          1928音乐餐吧(五月花店)  B0FFF0FKTH  113.266728,23.125756   \n",
       "4      萨莉亚意式餐厅(165五月花广场店)  B0G2XGJL5Q  113.267023,23.125886   \n",
       "5                  聚谊阁西餐厅  B0FFFZD6YX  113.269414,23.128872   \n",
       "6                 牛一安格斯牛扒  B0I63UZKVF  113.262729,23.128861   \n",
       "7        转角遇到爱休闲餐厅(广州起义路)  B0FFFPA2J2  113.264023,23.123793   \n",
       "8              大家点(中山四路店)  B0FFG2M704  113.270877,23.125499   \n",
       "9                    蜜荟西餐  B0H2RZ3XID  113.258857,23.125932   \n",
       "\n",
       "                              type       typecode pname cityname adname  \\\n",
       "0                     餐饮服务;快餐厅;快餐厅         050300   广东省      广州市    越秀区   \n",
       "1              餐饮服务;外国餐厅;西餐厅(综合风味)         050201   广东省      广州市    越秀区   \n",
       "2              餐饮服务;外国餐厅;西餐厅(综合风味)         050201   广东省      广州市    越秀区   \n",
       "3                 餐饮服务;外国餐厅;法式菜品餐厅         050204   广东省      广州市    越秀区   \n",
       "4                 餐饮服务;外国餐厅;意式菜品餐厅         050205   广东省      广州市    越秀区   \n",
       "5              餐饮服务;外国餐厅;西餐厅(综合风味)         050201   广东省      广州市    越秀区   \n",
       "6                餐饮服务;外国餐厅;牛扒店(扒房)         050211   广东省      广州市    越秀区   \n",
       "7  餐饮服务;中餐厅;中餐厅|餐饮服务;休闲餐饮场所;休闲餐饮场所  050100|050400   广东省      广州市    越秀区   \n",
       "8   餐饮服务;中餐厅;广东菜(粤菜)|餐饮服务;中餐厅;海鲜酒楼  050103|050119   广东省      广州市    越秀区   \n",
       "9              餐饮服务;外国餐厅;西餐厅(综合风味)         050201   广东省      广州市    越秀区   \n",
       "\n",
       "                              address   pcode citycode  adcode  \\\n",
       "0             中山五路6号2、3层(北京路新大新商场正门旁)  440000      020  440104   \n",
       "1           五月花商业广场4楼(公园前地铁站出入口步行90米)  440000      020  440104   \n",
       "2            北京路342号(公园前地铁站出入口步行240米)  440000      020  440104   \n",
       "3                    中山五路68号五月花商业广场4楼  440000      020  440104   \n",
       "4                    中山五路68号五月花商业广场B1  440000      020  440104   \n",
       "5                       北京路374号广州大厦3楼  440000      020  440104   \n",
       "6                         北京街道街府前路15号  440000      020  440104   \n",
       "7         起义路253号2-4层(公园前地铁站J口步行110米)  440000      020  440104   \n",
       "8  中山四路333号,335号万方字画批发商都五楼(北京路步行街50米)  440000      020  440104   \n",
       "9            惠吉西一坊10号(西门口地铁站B口步行380米)  440000      020  440104   \n",
       "\n",
       "                                              photos  \n",
       "0  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "1  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "2  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "3  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "4  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "5  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "6                                                NaN  \n",
       "7  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "8  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "9  [{'title': '', 'url': 'http://store.is.autonav...  "
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.json_normalize(r.json()['pois'])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "85b3499e",
   "metadata": {},
   "source": [
    "## 总和 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "id": "be0e3a9e",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 2.请求方法：GET\n",
    "# 3.请求的关键字搜索url地址：https://restapi.amap.com/v5/place/text?parameters\n",
    "keyword_url = \"https://restapi.amap.com/v5/place/text?parameters\"\n",
    "\n",
    "# 4.请求的参数（payload）\n",
    "payload = {\n",
    "    \"key\":\"091c69bb3b356e0f0eb237e4e7a62a45\",\n",
    "    \"keywords\":\"中餐厅|西餐厅|快餐厅\",\n",
    "    \"city\":\"广州\",\n",
    "    \"extensions\":\"all\",\n",
    "    \"show_fields\":\"photos\"\n",
    "}\n",
    "# 5.发起请求\n",
    "r = requests.get(url=keyword_url,params=payload)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "id": "36b82b6e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'status': '1',\n",
       " 'info': 'OK',\n",
       " 'infocode': '10000',\n",
       " 'pois': [{'name': '畔山酒店中餐厅',\n",
       "   'id': 'B00140U418',\n",
       "   'location': '113.278555,23.150403',\n",
       "   'type': '餐饮服务;中餐厅;中餐厅',\n",
       "   'typecode': '050100',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '越秀区',\n",
       "   'address': '麓景路11号麓湖公园内(近乡村俱乐部)',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440104',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/2e9edea4f56cc9ccdafbae72b113fbd6'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/07c19379c28880eaa1f319c3074ef0ce'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/1f1e16c25779594f43f89e18e70af119'}]},\n",
       "  {'name': '桃源西餐厅',\n",
       "   'id': 'B00140C691',\n",
       "   'location': '113.267843,23.114821',\n",
       "   'type': '餐饮服务;外国餐厅;西餐厅(综合风味)',\n",
       "   'typecode': '050201',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '越秀区',\n",
       "   'address': '海珠广场侨江路8号39楼',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440104',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/abb7d31ce501d84acc723c92edea9092'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/fdc0a04903724e831945b9110badebce'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/74cd5afe72bd29a75cbd1ae9ab1840c8'}]},\n",
       "  {'name': '科芬园西餐厅',\n",
       "   'id': 'B00141UP7F',\n",
       "   'location': '113.266448,23.080275',\n",
       "   'type': '餐饮服务;外国餐厅;西餐厅(综合风味)',\n",
       "   'typecode': '050201',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '海珠区',\n",
       "   'address': '工业大道中222号卡威尔酒店1楼大堂',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440105',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/3e01fa4d1393c01e1cc73e123fad67fc'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/8a5d0bf58dec7142eea29a8e9aafcf41'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/96527c4c9b501d5b296c10bcb962e5cf'}]},\n",
       "  {'name': '桃源中餐厅',\n",
       "   'id': 'B00141KOQO',\n",
       "   'location': '113.416022,23.460124',\n",
       "   'type': '餐饮服务;中餐厅;中餐厅',\n",
       "   'typecode': '050100',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '花都区',\n",
       "   'address': '华东镇九龙湖社区九龙湖公主酒店',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440114',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/0b37a953a0f0f4dd5711cab3ea060b38'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/10dd1b049f8c5850e435787c2f401c9f'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/18a0dc09b7ce6fb25974a97eeec542c2'}]},\n",
       "  {'name': '夏宫中餐厅',\n",
       "   'id': 'B00140UHZM',\n",
       "   'location': '113.370184,23.102533',\n",
       "   'type': '餐饮服务;中餐厅;中餐厅',\n",
       "   'typecode': '050100',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '海珠区',\n",
       "   'address': '会展东路1号广州香格里拉大酒店2层',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440105',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/63f2e78ba97ef0aa8303c59faec6734a'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/c3d052d86843f6d5455e4db5380ff197'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/53a6da009a3d14e7e3b52e9b3b504720'}]},\n",
       "  {'name': '枫叶西餐厅',\n",
       "   'id': 'B00141V6JL',\n",
       "   'location': '113.434298,22.954861',\n",
       "   'type': '餐饮服务;外国餐厅;外国餐厅',\n",
       "   'typecode': '050200',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '番禺区',\n",
       "   'address': '石碁镇市莲路龙涌东路8号(近大龙桥)',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440113',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/d6df7501ff7c2d40600b732d46c8b371'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/69a0b78d944d26c27537b62ea91c5f12'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/57140cc9df0ad3a16da8ef9e5b85e748'}]},\n",
       "  {'name': '伯顿西餐厅(金福星广场店)',\n",
       "   'id': 'B00141OAW6',\n",
       "   'location': '113.610332,23.117562',\n",
       "   'type': '餐饮服务;外国餐厅;西餐厅(综合风味)',\n",
       "   'typecode': '050201',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '增城区',\n",
       "   'address': '新塘镇金福星广场东南路第1号商铺',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440118',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/03fa5ee82d615385c1ef3b2f79bdc210'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/670a9f7c807db2297bc6c9500dd43279'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/19cee90f5db5c15831207a12fb6bbabb'}]},\n",
       "  {'name': '云轩中餐厅',\n",
       "   'id': 'B00141KZHH',\n",
       "   'location': '113.341650,23.125625',\n",
       "   'type': '餐饮服务;中餐厅;广东菜(粤菜)',\n",
       "   'typecode': '050103',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '天河区',\n",
       "   'address': '黄埔大道西126号云来斯堡酒店内',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440106',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/d54d8d0e1b992c963a9084bc9fe3ebeb'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/993c21e13425e780bb1b892db2d82051'},\n",
       "    {'title': '',\n",
       "     'url': 'https://img.alicdn.com/imgextra/i1/3695320962/O1CN011IydiRZxUfamnTE_!!3695320962-0-kbcontentapng.jpg'}]},\n",
       "  {'name': '回味鸡快餐厅(均禾分店)',\n",
       "   'id': 'B00140W3I2',\n",
       "   'location': '113.293941,23.263206',\n",
       "   'type': '餐饮服务;中餐厅;中餐厅',\n",
       "   'typecode': '050100',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '白云区',\n",
       "   'address': '长红竹仔园西商街181号',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440111',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/5598ee0412faa7fe312bb8cb9d3fcc77'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/f1a71a8e8b76ef9497fd37321a903e6d'}]},\n",
       "  {'name': '燕岭大厦西餐厅',\n",
       "   'id': 'B0FFFQ6B77',\n",
       "   'location': '113.326656,23.159252',\n",
       "   'type': '餐饮服务;外国餐厅;西餐厅(综合风味)',\n",
       "   'typecode': '050201',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '天河区',\n",
       "   'address': '燕岭路29号燕岭大厦首层(燕塘地铁站B口步行60米)',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440106',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/2e5fa85225b2cd3c481acf5477073d40'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/e2cf46b04eab9779fb40d3608739ed39'}]}],\n",
       " 'count': '10'}"
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "id": "cb95bf16",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>id</th>\n",
       "      <th>location</th>\n",
       "      <th>type</th>\n",
       "      <th>typecode</th>\n",
       "      <th>pname</th>\n",
       "      <th>cityname</th>\n",
       "      <th>adname</th>\n",
       "      <th>address</th>\n",
       "      <th>pcode</th>\n",
       "      <th>citycode</th>\n",
       "      <th>adcode</th>\n",
       "      <th>photos</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>畔山酒店中餐厅</td>\n",
       "      <td>B00140U418</td>\n",
       "      <td>113.278555,23.150403</td>\n",
       "      <td>餐饮服务;中餐厅;中餐厅</td>\n",
       "      <td>050100</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>越秀区</td>\n",
       "      <td>麓景路11号麓湖公园内(近乡村俱乐部)</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440104</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>桃源西餐厅</td>\n",
       "      <td>B00140C691</td>\n",
       "      <td>113.267843,23.114821</td>\n",
       "      <td>餐饮服务;外国餐厅;西餐厅(综合风味)</td>\n",
       "      <td>050201</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>越秀区</td>\n",
       "      <td>海珠广场侨江路8号39楼</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440104</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>科芬园西餐厅</td>\n",
       "      <td>B00141UP7F</td>\n",
       "      <td>113.266448,23.080275</td>\n",
       "      <td>餐饮服务;外国餐厅;西餐厅(综合风味)</td>\n",
       "      <td>050201</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>海珠区</td>\n",
       "      <td>工业大道中222号卡威尔酒店1楼大堂</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440105</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>桃源中餐厅</td>\n",
       "      <td>B00141KOQO</td>\n",
       "      <td>113.416022,23.460124</td>\n",
       "      <td>餐饮服务;中餐厅;中餐厅</td>\n",
       "      <td>050100</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>花都区</td>\n",
       "      <td>华东镇九龙湖社区九龙湖公主酒店</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440114</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>夏宫中餐厅</td>\n",
       "      <td>B00140UHZM</td>\n",
       "      <td>113.370184,23.102533</td>\n",
       "      <td>餐饮服务;中餐厅;中餐厅</td>\n",
       "      <td>050100</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>海珠区</td>\n",
       "      <td>会展东路1号广州香格里拉大酒店2层</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440105</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>枫叶西餐厅</td>\n",
       "      <td>B00141V6JL</td>\n",
       "      <td>113.434298,22.954861</td>\n",
       "      <td>餐饮服务;外国餐厅;外国餐厅</td>\n",
       "      <td>050200</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>番禺区</td>\n",
       "      <td>石碁镇市莲路龙涌东路8号(近大龙桥)</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440113</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>伯顿西餐厅(金福星广场店)</td>\n",
       "      <td>B00141OAW6</td>\n",
       "      <td>113.610332,23.117562</td>\n",
       "      <td>餐饮服务;外国餐厅;西餐厅(综合风味)</td>\n",
       "      <td>050201</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>增城区</td>\n",
       "      <td>新塘镇金福星广场东南路第1号商铺</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440118</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>云轩中餐厅</td>\n",
       "      <td>B00141KZHH</td>\n",
       "      <td>113.341650,23.125625</td>\n",
       "      <td>餐饮服务;中餐厅;广东菜(粤菜)</td>\n",
       "      <td>050103</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>天河区</td>\n",
       "      <td>黄埔大道西126号云来斯堡酒店内</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440106</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>回味鸡快餐厅(均禾分店)</td>\n",
       "      <td>B00140W3I2</td>\n",
       "      <td>113.293941,23.263206</td>\n",
       "      <td>餐饮服务;中餐厅;中餐厅</td>\n",
       "      <td>050100</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>白云区</td>\n",
       "      <td>长红竹仔园西商街181号</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440111</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>燕岭大厦西餐厅</td>\n",
       "      <td>B0FFFQ6B77</td>\n",
       "      <td>113.326656,23.159252</td>\n",
       "      <td>餐饮服务;外国餐厅;西餐厅(综合风味)</td>\n",
       "      <td>050201</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>天河区</td>\n",
       "      <td>燕岭路29号燕岭大厦首层(燕塘地铁站B口步行60米)</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440106</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            name          id              location                 type  \\\n",
       "0        畔山酒店中餐厅  B00140U418  113.278555,23.150403         餐饮服务;中餐厅;中餐厅   \n",
       "1          桃源西餐厅  B00140C691  113.267843,23.114821  餐饮服务;外国餐厅;西餐厅(综合风味)   \n",
       "2         科芬园西餐厅  B00141UP7F  113.266448,23.080275  餐饮服务;外国餐厅;西餐厅(综合风味)   \n",
       "3          桃源中餐厅  B00141KOQO  113.416022,23.460124         餐饮服务;中餐厅;中餐厅   \n",
       "4          夏宫中餐厅  B00140UHZM  113.370184,23.102533         餐饮服务;中餐厅;中餐厅   \n",
       "5          枫叶西餐厅  B00141V6JL  113.434298,22.954861       餐饮服务;外国餐厅;外国餐厅   \n",
       "6  伯顿西餐厅(金福星广场店)  B00141OAW6  113.610332,23.117562  餐饮服务;外国餐厅;西餐厅(综合风味)   \n",
       "7          云轩中餐厅  B00141KZHH  113.341650,23.125625     餐饮服务;中餐厅;广东菜(粤菜)   \n",
       "8   回味鸡快餐厅(均禾分店)  B00140W3I2  113.293941,23.263206         餐饮服务;中餐厅;中餐厅   \n",
       "9        燕岭大厦西餐厅  B0FFFQ6B77  113.326656,23.159252  餐饮服务;外国餐厅;西餐厅(综合风味)   \n",
       "\n",
       "  typecode pname cityname adname                     address   pcode citycode  \\\n",
       "0   050100   广东省      广州市    越秀区         麓景路11号麓湖公园内(近乡村俱乐部)  440000      020   \n",
       "1   050201   广东省      广州市    越秀区                海珠广场侨江路8号39楼  440000      020   \n",
       "2   050201   广东省      广州市    海珠区          工业大道中222号卡威尔酒店1楼大堂  440000      020   \n",
       "3   050100   广东省      广州市    花都区             华东镇九龙湖社区九龙湖公主酒店  440000      020   \n",
       "4   050100   广东省      广州市    海珠区           会展东路1号广州香格里拉大酒店2层  440000      020   \n",
       "5   050200   广东省      广州市    番禺区          石碁镇市莲路龙涌东路8号(近大龙桥)  440000      020   \n",
       "6   050201   广东省      广州市    增城区            新塘镇金福星广场东南路第1号商铺  440000      020   \n",
       "7   050103   广东省      广州市    天河区            黄埔大道西126号云来斯堡酒店内  440000      020   \n",
       "8   050100   广东省      广州市    白云区                长红竹仔园西商街181号  440000      020   \n",
       "9   050201   广东省      广州市    天河区  燕岭路29号燕岭大厦首层(燕塘地铁站B口步行60米)  440000      020   \n",
       "\n",
       "   adcode                                             photos  \n",
       "0  440104  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "1  440104  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "2  440105  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "3  440114  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "4  440105  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "5  440113  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "6  440118  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "7  440106  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "8  440111  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "9  440106  [{'title': '', 'url': 'http://store.is.autonav...  "
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.json_normalize(r.json()['pois'])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e1636ea1",
   "metadata": {},
   "source": [
    "## 2.周边搜索"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "06d66faf",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 2.请求方法：GET\n",
    "# 3.请求的周边搜索url地址：https://restapi.amap.com/v5/place/around?parameters\n",
    "around_url = \"https://restapi.amap.com/v5/place/around?parameters\"\n",
    "\n",
    "# 4.请求的参数（payload）\n",
    "payload = {\n",
    "    \"key\":\"091c69bb3b356e0f0eb237e4e7a62a45\",\n",
    "    \"types\":\"快餐厅\",\n",
    "    \"location\":\"113.678280,23.628439\",\n",
    "    \"extensions\":\"all\",\n",
    "    \"show_fields\":\"photos\"\n",
    "}\n",
    "# 5.发起请求\n",
    "r = requests.get(url=keyword_url,params=payload)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "14a0d46a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Response [200]>"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "bc32f7b3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'status': '1',\n",
       " 'info': 'OK',\n",
       " 'infocode': '10000',\n",
       " 'pois': [{'name': '十三幺熟食牛杂',\n",
       "   'id': 'B0G3ASF92M',\n",
       "   'location': '113.679565,23.627501',\n",
       "   'type': '餐饮服务;快餐厅;快餐厅',\n",
       "   'typecode': '050300',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '温泉镇广州南方学院后门润泰超市1层05号商铺',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'},\n",
       "  {'name': 'PROJECT.B美式汉堡(中大店)',\n",
       "   'id': 'B0HROCM4JK',\n",
       "   'location': '113.678983,23.627778',\n",
       "   'type': '餐饮服务;快餐厅;快餐厅',\n",
       "   'typecode': '050300',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '温泉镇南方公寓',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'},\n",
       "  {'name': '汉堡小亨(中大店)',\n",
       "   'id': 'B0H1M7Z0IF',\n",
       "   'location': '113.676765,23.630495',\n",
       "   'type': '餐饮服务;快餐厅;快餐厅',\n",
       "   'typecode': '050300',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '温泉镇广州中大南方招待所中山大学南方学院',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'},\n",
       "  {'name': '美乐佳汉堡',\n",
       "   'id': 'B0FFJ7XDGE',\n",
       "   'location': '113.680172,23.630300',\n",
       "   'type': '餐饮服务;快餐厅;快餐厅',\n",
       "   'typecode': '050300',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '温泉镇广州南方学院商贸城二楼',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/bc684433f719439e9b7ed3476fdc57ca'}]},\n",
       "  {'name': '阪尚釜五谷鱼粉(广州南方学院店)',\n",
       "   'id': 'B0FFGT2QG2',\n",
       "   'location': '113.680413,23.630370',\n",
       "   'type': '餐饮服务;快餐厅;快餐厅',\n",
       "   'typecode': '050300',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '广州南方学院商业中心二楼',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'},\n",
       "  {'name': '堡得士(中大店)',\n",
       "   'id': 'B0H1M7YLUH',\n",
       "   'location': '113.676742,23.632175',\n",
       "   'type': '餐饮服务;快餐厅;快餐厅',\n",
       "   'typecode': '050300',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '温泉镇宣星一社自编00894号',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'},\n",
       "  {'name': '贪吃小站',\n",
       "   'id': 'B0H6Y1BXZY',\n",
       "   'location': '113.679284,23.632574',\n",
       "   'type': '餐饮服务;快餐厅;快餐厅',\n",
       "   'typecode': '050300',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '温泉镇广州南方学院后门润泰超市首层2号',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'},\n",
       "  {'name': '益街坊',\n",
       "   'id': 'B0H6Y1BXZQ',\n",
       "   'location': '113.679291,23.632574',\n",
       "   'type': '餐饮服务;快餐厅;快餐厅',\n",
       "   'typecode': '050300',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '温泉镇广州南方学院后门润泰超市首层7号',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'},\n",
       "  {'name': '珍味烧鹅',\n",
       "   'id': 'B0GKSDK3I1',\n",
       "   'location': '113.679291,23.632574',\n",
       "   'type': '餐饮服务;快餐厅;快餐厅',\n",
       "   'typecode': '050300',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '广州南方学院博学路6号',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'},\n",
       "  {'name': '庄海烧腊店',\n",
       "   'id': 'B0G3MR1ULG',\n",
       "   'location': '113.679405,23.632673',\n",
       "   'type': '餐饮服务;快餐厅;快餐厅',\n",
       "   'typecode': '050300',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '温泉镇广州南方学院后门润泰超市1层05号商铺',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'}],\n",
       " 'count': '10'}"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "867608ed",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>id</th>\n",
       "      <th>location</th>\n",
       "      <th>type</th>\n",
       "      <th>typecode</th>\n",
       "      <th>pname</th>\n",
       "      <th>cityname</th>\n",
       "      <th>adname</th>\n",
       "      <th>address</th>\n",
       "      <th>pcode</th>\n",
       "      <th>citycode</th>\n",
       "      <th>adcode</th>\n",
       "      <th>photos</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>十三幺熟食牛杂</td>\n",
       "      <td>B0G3ASF92M</td>\n",
       "      <td>113.679565,23.627501</td>\n",
       "      <td>餐饮服务;快餐厅;快餐厅</td>\n",
       "      <td>050300</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>从化区</td>\n",
       "      <td>温泉镇广州南方学院后门润泰超市1层05号商铺</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440117</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>PROJECT.B美式汉堡(中大店)</td>\n",
       "      <td>B0HROCM4JK</td>\n",
       "      <td>113.678983,23.627778</td>\n",
       "      <td>餐饮服务;快餐厅;快餐厅</td>\n",
       "      <td>050300</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>从化区</td>\n",
       "      <td>温泉镇南方公寓</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440117</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>汉堡小亨(中大店)</td>\n",
       "      <td>B0H1M7Z0IF</td>\n",
       "      <td>113.676765,23.630495</td>\n",
       "      <td>餐饮服务;快餐厅;快餐厅</td>\n",
       "      <td>050300</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>从化区</td>\n",
       "      <td>温泉镇广州中大南方招待所中山大学南方学院</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440117</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>美乐佳汉堡</td>\n",
       "      <td>B0FFJ7XDGE</td>\n",
       "      <td>113.680172,23.630300</td>\n",
       "      <td>餐饮服务;快餐厅;快餐厅</td>\n",
       "      <td>050300</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>从化区</td>\n",
       "      <td>温泉镇广州南方学院商贸城二楼</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440117</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>阪尚釜五谷鱼粉(广州南方学院店)</td>\n",
       "      <td>B0FFGT2QG2</td>\n",
       "      <td>113.680413,23.630370</td>\n",
       "      <td>餐饮服务;快餐厅;快餐厅</td>\n",
       "      <td>050300</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>从化区</td>\n",
       "      <td>广州南方学院商业中心二楼</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440117</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>堡得士(中大店)</td>\n",
       "      <td>B0H1M7YLUH</td>\n",
       "      <td>113.676742,23.632175</td>\n",
       "      <td>餐饮服务;快餐厅;快餐厅</td>\n",
       "      <td>050300</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>从化区</td>\n",
       "      <td>温泉镇宣星一社自编00894号</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440117</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>贪吃小站</td>\n",
       "      <td>B0H6Y1BXZY</td>\n",
       "      <td>113.679284,23.632574</td>\n",
       "      <td>餐饮服务;快餐厅;快餐厅</td>\n",
       "      <td>050300</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>从化区</td>\n",
       "      <td>温泉镇广州南方学院后门润泰超市首层2号</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440117</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>益街坊</td>\n",
       "      <td>B0H6Y1BXZQ</td>\n",
       "      <td>113.679291,23.632574</td>\n",
       "      <td>餐饮服务;快餐厅;快餐厅</td>\n",
       "      <td>050300</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>从化区</td>\n",
       "      <td>温泉镇广州南方学院后门润泰超市首层7号</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440117</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>珍味烧鹅</td>\n",
       "      <td>B0GKSDK3I1</td>\n",
       "      <td>113.679291,23.632574</td>\n",
       "      <td>餐饮服务;快餐厅;快餐厅</td>\n",
       "      <td>050300</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>从化区</td>\n",
       "      <td>广州南方学院博学路6号</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440117</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>庄海烧腊店</td>\n",
       "      <td>B0G3MR1ULG</td>\n",
       "      <td>113.679405,23.632673</td>\n",
       "      <td>餐饮服务;快餐厅;快餐厅</td>\n",
       "      <td>050300</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>从化区</td>\n",
       "      <td>温泉镇广州南方学院后门润泰超市1层05号商铺</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440117</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                 name          id              location          type  \\\n",
       "0             十三幺熟食牛杂  B0G3ASF92M  113.679565,23.627501  餐饮服务;快餐厅;快餐厅   \n",
       "1  PROJECT.B美式汉堡(中大店)  B0HROCM4JK  113.678983,23.627778  餐饮服务;快餐厅;快餐厅   \n",
       "2           汉堡小亨(中大店)  B0H1M7Z0IF  113.676765,23.630495  餐饮服务;快餐厅;快餐厅   \n",
       "3               美乐佳汉堡  B0FFJ7XDGE  113.680172,23.630300  餐饮服务;快餐厅;快餐厅   \n",
       "4    阪尚釜五谷鱼粉(广州南方学院店)  B0FFGT2QG2  113.680413,23.630370  餐饮服务;快餐厅;快餐厅   \n",
       "5            堡得士(中大店)  B0H1M7YLUH  113.676742,23.632175  餐饮服务;快餐厅;快餐厅   \n",
       "6                贪吃小站  B0H6Y1BXZY  113.679284,23.632574  餐饮服务;快餐厅;快餐厅   \n",
       "7                 益街坊  B0H6Y1BXZQ  113.679291,23.632574  餐饮服务;快餐厅;快餐厅   \n",
       "8                珍味烧鹅  B0GKSDK3I1  113.679291,23.632574  餐饮服务;快餐厅;快餐厅   \n",
       "9               庄海烧腊店  B0G3MR1ULG  113.679405,23.632673  餐饮服务;快餐厅;快餐厅   \n",
       "\n",
       "  typecode pname cityname adname                 address   pcode citycode  \\\n",
       "0   050300   广东省      广州市    从化区  温泉镇广州南方学院后门润泰超市1层05号商铺  440000      020   \n",
       "1   050300   广东省      广州市    从化区                 温泉镇南方公寓  440000      020   \n",
       "2   050300   广东省      广州市    从化区    温泉镇广州中大南方招待所中山大学南方学院  440000      020   \n",
       "3   050300   广东省      广州市    从化区          温泉镇广州南方学院商贸城二楼  440000      020   \n",
       "4   050300   广东省      广州市    从化区            广州南方学院商业中心二楼  440000      020   \n",
       "5   050300   广东省      广州市    从化区         温泉镇宣星一社自编00894号  440000      020   \n",
       "6   050300   广东省      广州市    从化区     温泉镇广州南方学院后门润泰超市首层2号  440000      020   \n",
       "7   050300   广东省      广州市    从化区     温泉镇广州南方学院后门润泰超市首层7号  440000      020   \n",
       "8   050300   广东省      广州市    从化区             广州南方学院博学路6号  440000      020   \n",
       "9   050300   广东省      广州市    从化区  温泉镇广州南方学院后门润泰超市1层05号商铺  440000      020   \n",
       "\n",
       "   adcode                                             photos  \n",
       "0  440117                                                NaN  \n",
       "1  440117                                                NaN  \n",
       "2  440117                                                NaN  \n",
       "3  440117  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "4  440117                                                NaN  \n",
       "5  440117                                                NaN  \n",
       "6  440117                                                NaN  \n",
       "7  440117                                                NaN  \n",
       "8  440117                                                NaN  \n",
       "9  440117                                                NaN  "
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.json_normalize(r.json()['pois'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "id": "c4e3bedf",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 2.请求方法：GET\n",
    "# 3.请求的周边搜索url地址：https://restapi.amap.com/v5/place/around?parameters\n",
    "around_url = \"https://restapi.amap.com/v5/place/around?parameters\"\n",
    "\n",
    "# 4.请求的参数（payload）\n",
    "payload = {\n",
    "    \"key\":\"091c69bb3b356e0f0eb237e4e7a62a45\",\n",
    "    \"types\":\"外国餐厅\",\n",
    "    \"location\":\"113.678280,23.628439\",\n",
    "    \"extensions\":\"all\",\n",
    "    \"show_fields\":\"photos\"\n",
    "}\n",
    "# 5.发起请求\n",
    "r = requests.get(url=keyword_url,params=payload)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "id": "bbfb6f41",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'status': '1',\n",
       " 'info': 'OK',\n",
       " 'infocode': '10000',\n",
       " 'pois': [{'name': '炸鸡队长(韩式炸鸡店)',\n",
       "   'id': 'B0FFHVMT24',\n",
       "   'location': '113.676603,23.630170',\n",
       "   'type': '餐饮服务;外国餐厅;韩国料理',\n",
       "   'typecode': '050203',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '温泉镇中山大学南方学院南门',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'},\n",
       "  {'name': '鸡啤咯哒(中大店)',\n",
       "   'id': 'B0HROCMJ59',\n",
       "   'location': '113.680035,23.631318',\n",
       "   'type': '餐饮服务;外国餐厅;韩国料理',\n",
       "   'typecode': '050203',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '温泉镇温泉乌土村随便公寓',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'},\n",
       "  {'name': '井炙寿司(广州南方学院店)',\n",
       "   'id': 'B0G3VBBFDG',\n",
       "   'location': '113.680297,23.630547',\n",
       "   'type': '餐饮服务;外国餐厅;外国餐厅',\n",
       "   'typecode': '050200',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '广州南方学院商业中心一楼',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'},\n",
       "  {'name': 'Uni-hotel西餐',\n",
       "   'id': 'B0GR3OMDZ2',\n",
       "   'location': '113.679222,23.632671',\n",
       "   'type': '餐饮服务;外国餐厅;西餐厅(综合风味)',\n",
       "   'typecode': '050201',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '温泉区广州南方学院',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'},\n",
       "  {'name': '80后铁板烧',\n",
       "   'id': 'B0H6ZUSDBT',\n",
       "   'location': '113.679405,23.632673',\n",
       "   'type': '餐饮服务;外国餐厅;外国餐厅',\n",
       "   'typecode': '050200',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '温泉镇广州南方学院后门润泰超市1层05号商铺',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'},\n",
       "  {'name': '碧泉空中温泉酒店西餐厅',\n",
       "   'id': 'B0FFHE6NL2',\n",
       "   'location': '113.654605,23.646045',\n",
       "   'type': '餐饮服务;外国餐厅;外国餐厅',\n",
       "   'typecode': '050200',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '温泉东路76号',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/a01f74db4bd9a02e38c932c34a88c604'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/c729fe864c7706726301e8a703425899'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/c85d4fca3d0c605817d1000aefa9dee0'}]},\n",
       "  {'name': '快乐星汉堡',\n",
       "   'id': 'B0FFIN70CR',\n",
       "   'location': '113.670232,23.603146',\n",
       "   'type': '餐饮服务;外国餐厅;西餐厅(综合风味)',\n",
       "   'typecode': '050201',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '桃园东路与新教路交叉口东北40米',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'},\n",
       "  {'name': '沅味寿司料理',\n",
       "   'id': 'B0FFKUO16G',\n",
       "   'location': '113.655381,23.645329',\n",
       "   'type': '餐饮服务;外国餐厅;日本料理',\n",
       "   'typecode': '050202',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '碧泉一横街15号',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/4ecc44816d90d5af0317a408388f83aa'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/170764baa87f82d8449dc3fb290806ba'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/3c60a42f0ef79363225bad3f2c5f08f2'}]},\n",
       "  {'name': '米斯特比萨',\n",
       "   'id': 'B0FFKT17JQ',\n",
       "   'location': '113.698059,23.611033',\n",
       "   'type': '餐饮服务;外国餐厅;外国餐厅',\n",
       "   'typecode': '050200',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '温泉镇石坑村东儒队00762号',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'},\n",
       "  {'name': '柴火烧肉',\n",
       "   'id': 'B0FFK6BPAQ',\n",
       "   'location': '113.658722,23.642190',\n",
       "   'type': '餐饮服务;外国餐厅;其它亚洲菜',\n",
       "   'typecode': '050217',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '村委东侧路与温泉东路西一巷交叉口东北20米',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/589899a0d77b1d90ab2ffc33efca04e3'}]}],\n",
       " 'count': '10'}"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "id": "7ad11e17",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>id</th>\n",
       "      <th>location</th>\n",
       "      <th>type</th>\n",
       "      <th>typecode</th>\n",
       "      <th>pname</th>\n",
       "      <th>cityname</th>\n",
       "      <th>adname</th>\n",
       "      <th>address</th>\n",
       "      <th>pcode</th>\n",
       "      <th>citycode</th>\n",
       "      <th>adcode</th>\n",
       "      <th>photos</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>炸鸡队长(韩式炸鸡店)</td>\n",
       "      <td>B0FFHVMT24</td>\n",
       "      <td>113.676603,23.630170</td>\n",
       "      <td>餐饮服务;外国餐厅;韩国料理</td>\n",
       "      <td>050203</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>从化区</td>\n",
       "      <td>温泉镇中山大学南方学院南门</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440117</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>鸡啤咯哒(中大店)</td>\n",
       "      <td>B0HROCMJ59</td>\n",
       "      <td>113.680035,23.631318</td>\n",
       "      <td>餐饮服务;外国餐厅;韩国料理</td>\n",
       "      <td>050203</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>从化区</td>\n",
       "      <td>温泉镇温泉乌土村随便公寓</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440117</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>井炙寿司(广州南方学院店)</td>\n",
       "      <td>B0G3VBBFDG</td>\n",
       "      <td>113.680297,23.630547</td>\n",
       "      <td>餐饮服务;外国餐厅;外国餐厅</td>\n",
       "      <td>050200</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>从化区</td>\n",
       "      <td>广州南方学院商业中心一楼</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440117</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Uni-hotel西餐</td>\n",
       "      <td>B0GR3OMDZ2</td>\n",
       "      <td>113.679222,23.632671</td>\n",
       "      <td>餐饮服务;外国餐厅;西餐厅(综合风味)</td>\n",
       "      <td>050201</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>从化区</td>\n",
       "      <td>温泉区广州南方学院</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440117</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>80后铁板烧</td>\n",
       "      <td>B0H6ZUSDBT</td>\n",
       "      <td>113.679405,23.632673</td>\n",
       "      <td>餐饮服务;外国餐厅;外国餐厅</td>\n",
       "      <td>050200</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>从化区</td>\n",
       "      <td>温泉镇广州南方学院后门润泰超市1层05号商铺</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440117</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>碧泉空中温泉酒店西餐厅</td>\n",
       "      <td>B0FFHE6NL2</td>\n",
       "      <td>113.654605,23.646045</td>\n",
       "      <td>餐饮服务;外国餐厅;外国餐厅</td>\n",
       "      <td>050200</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>从化区</td>\n",
       "      <td>温泉东路76号</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440117</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>快乐星汉堡</td>\n",
       "      <td>B0FFIN70CR</td>\n",
       "      <td>113.670232,23.603146</td>\n",
       "      <td>餐饮服务;外国餐厅;西餐厅(综合风味)</td>\n",
       "      <td>050201</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>从化区</td>\n",
       "      <td>桃园东路与新教路交叉口东北40米</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440117</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>沅味寿司料理</td>\n",
       "      <td>B0FFKUO16G</td>\n",
       "      <td>113.655381,23.645329</td>\n",
       "      <td>餐饮服务;外国餐厅;日本料理</td>\n",
       "      <td>050202</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>从化区</td>\n",
       "      <td>碧泉一横街15号</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440117</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>米斯特比萨</td>\n",
       "      <td>B0FFKT17JQ</td>\n",
       "      <td>113.698059,23.611033</td>\n",
       "      <td>餐饮服务;外国餐厅;外国餐厅</td>\n",
       "      <td>050200</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>从化区</td>\n",
       "      <td>温泉镇石坑村东儒队00762号</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440117</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>柴火烧肉</td>\n",
       "      <td>B0FFK6BPAQ</td>\n",
       "      <td>113.658722,23.642190</td>\n",
       "      <td>餐饮服务;外国餐厅;其它亚洲菜</td>\n",
       "      <td>050217</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>从化区</td>\n",
       "      <td>村委东侧路与温泉东路西一巷交叉口东北20米</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440117</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            name          id              location                 type  \\\n",
       "0    炸鸡队长(韩式炸鸡店)  B0FFHVMT24  113.676603,23.630170       餐饮服务;外国餐厅;韩国料理   \n",
       "1      鸡啤咯哒(中大店)  B0HROCMJ59  113.680035,23.631318       餐饮服务;外国餐厅;韩国料理   \n",
       "2  井炙寿司(广州南方学院店)  B0G3VBBFDG  113.680297,23.630547       餐饮服务;外国餐厅;外国餐厅   \n",
       "3    Uni-hotel西餐  B0GR3OMDZ2  113.679222,23.632671  餐饮服务;外国餐厅;西餐厅(综合风味)   \n",
       "4         80后铁板烧  B0H6ZUSDBT  113.679405,23.632673       餐饮服务;外国餐厅;外国餐厅   \n",
       "5    碧泉空中温泉酒店西餐厅  B0FFHE6NL2  113.654605,23.646045       餐饮服务;外国餐厅;外国餐厅   \n",
       "6          快乐星汉堡  B0FFIN70CR  113.670232,23.603146  餐饮服务;外国餐厅;西餐厅(综合风味)   \n",
       "7         沅味寿司料理  B0FFKUO16G  113.655381,23.645329       餐饮服务;外国餐厅;日本料理   \n",
       "8          米斯特比萨  B0FFKT17JQ  113.698059,23.611033       餐饮服务;外国餐厅;外国餐厅   \n",
       "9           柴火烧肉  B0FFK6BPAQ  113.658722,23.642190      餐饮服务;外国餐厅;其它亚洲菜   \n",
       "\n",
       "  typecode pname cityname adname                 address   pcode citycode  \\\n",
       "0   050203   广东省      广州市    从化区           温泉镇中山大学南方学院南门  440000      020   \n",
       "1   050203   广东省      广州市    从化区            温泉镇温泉乌土村随便公寓  440000      020   \n",
       "2   050200   广东省      广州市    从化区            广州南方学院商业中心一楼  440000      020   \n",
       "3   050201   广东省      广州市    从化区               温泉区广州南方学院  440000      020   \n",
       "4   050200   广东省      广州市    从化区  温泉镇广州南方学院后门润泰超市1层05号商铺  440000      020   \n",
       "5   050200   广东省      广州市    从化区                 温泉东路76号  440000      020   \n",
       "6   050201   广东省      广州市    从化区        桃园东路与新教路交叉口东北40米  440000      020   \n",
       "7   050202   广东省      广州市    从化区                碧泉一横街15号  440000      020   \n",
       "8   050200   广东省      广州市    从化区         温泉镇石坑村东儒队00762号  440000      020   \n",
       "9   050217   广东省      广州市    从化区   村委东侧路与温泉东路西一巷交叉口东北20米  440000      020   \n",
       "\n",
       "   adcode                                             photos  \n",
       "0  440117                                                NaN  \n",
       "1  440117                                                NaN  \n",
       "2  440117                                                NaN  \n",
       "3  440117                                                NaN  \n",
       "4  440117                                                NaN  \n",
       "5  440117  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "6  440117                                                NaN  \n",
       "7  440117  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "8  440117                                                NaN  \n",
       "9  440117  [{'title': '', 'url': 'http://store.is.autonav...  "
      ]
     },
     "execution_count": 52,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.json_normalize(r.json()['pois'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "id": "22e5a868",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 2.请求方法：GET\n",
    "# 3.请求的周边搜索url地址：https://restapi.amap.com/v5/place/around?parameters\n",
    "around_url = \"https://restapi.amap.com/v5/place/around?parameters\"\n",
    "\n",
    "# 4.请求的参数（payload）\n",
    "payload = {\n",
    "    \"key\":\"091c69bb3b356e0f0eb237e4e7a62a45\",\n",
    "    \"types\":\"中餐厅|外国餐厅|快餐厅\",\n",
    "    \"location\":\"113.678280,23.628439\",\n",
    "    \"extensions\":\"all\",\n",
    "    \"show_fields\":\"photos\"\n",
    "}\n",
    "# 5.发起请求\n",
    "r = requests.get(url=keyword_url,params=payload)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "id": "d4adc31b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'status': '1',\n",
       " 'info': 'OK',\n",
       " 'infocode': '10000',\n",
       " 'pois': [{'name': '炸鸡队长(韩式炸鸡店)',\n",
       "   'id': 'B0FFHVMT24',\n",
       "   'location': '113.676603,23.630170',\n",
       "   'type': '餐饮服务;外国餐厅;韩国料理',\n",
       "   'typecode': '050203',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '温泉镇中山大学南方学院南门',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'},\n",
       "  {'name': '湖边纸包鱼',\n",
       "   'id': 'B0FFL7NUA2',\n",
       "   'location': '113.679861,23.630285',\n",
       "   'type': '餐饮服务;中餐厅;四川菜(川菜)',\n",
       "   'typecode': '050102',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '广州南方学院',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/20080ba9f6fcd2808d64ce149b517ca9'},\n",
       "    {'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/9f40694ca108a175d36847d03ecf4ec0'},\n",
       "    {'title': '',\n",
       "     'url': 'https://img.alicdn.com/imgextra/i2/3695320962/O1CN01JFnmLv1IydhNhdLT4_!!3695320962-0-kbcontentapng.jpg'}]},\n",
       "  {'name': '壹休盖饭',\n",
       "   'id': 'B0HRHG0RSP',\n",
       "   'location': '113.679611,23.630517',\n",
       "   'type': '餐饮服务;中餐厅;中餐厅',\n",
       "   'typecode': '050100',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '温泉镇乌土村上围2队13号',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'},\n",
       "  {'name': '鸡啤咯哒(中大店)',\n",
       "   'id': 'B0HROCMJ59',\n",
       "   'location': '113.680035,23.631318',\n",
       "   'type': '餐饮服务;外国餐厅;韩国料理',\n",
       "   'typecode': '050203',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '温泉镇温泉乌土村随便公寓',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'},\n",
       "  {'name': '井炙寿司(广州南方学院店)',\n",
       "   'id': 'B0G3VBBFDG',\n",
       "   'location': '113.680297,23.630547',\n",
       "   'type': '餐饮服务;外国餐厅;外国餐厅',\n",
       "   'typecode': '050200',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '广州南方学院商业中心一楼',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'},\n",
       "  {'name': 'Uni-hotel西餐',\n",
       "   'id': 'B0GR3OMDZ2',\n",
       "   'location': '113.679222,23.632671',\n",
       "   'type': '餐饮服务;外国餐厅;西餐厅(综合风味)',\n",
       "   'typecode': '050201',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '温泉区广州南方学院',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'},\n",
       "  {'name': '东记乡村美食',\n",
       "   'id': 'B0G3APADKJ',\n",
       "   'location': '113.679283,23.632572',\n",
       "   'type': '餐饮服务;中餐厅;中餐厅',\n",
       "   'typecode': '050100',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '温泉镇广州南方学院后门润泰超市1层05号商铺',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'},\n",
       "  {'name': '80后铁板烧',\n",
       "   'id': 'B0H6ZUSDBT',\n",
       "   'location': '113.679405,23.632673',\n",
       "   'type': '餐饮服务;外国餐厅;外国餐厅',\n",
       "   'typecode': '050200',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '温泉镇广州南方学院后门润泰超市1层05号商铺',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'},\n",
       "  {'name': '幸福楼酒店(温泉东路)',\n",
       "   'id': 'B00140FG8A',\n",
       "   'location': '113.654186,23.644836',\n",
       "   'type': '餐饮服务;中餐厅;中餐厅',\n",
       "   'typecode': '050100',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '温泉镇温泉东路99号',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117',\n",
       "   'photos': [{'title': '',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/18132bec7fd836ec909aae4ad8d92e5f'},\n",
       "    {'title': '产品图',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/9d00e60d9421930c973d23c0ce6fd0fb'},\n",
       "    {'title': '产品图',\n",
       "     'url': 'http://store.is.autonavi.com/showpic/c12a7ff8105dd732137d63da821b6a5e'}]},\n",
       "  {'name': '佳乐堡',\n",
       "   'id': 'B0FFKT7WD8',\n",
       "   'location': '113.675576,23.620716',\n",
       "   'type': '餐饮服务;快餐厅;快餐厅',\n",
       "   'typecode': '050300',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '温泉镇乌土村松浪队',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'}],\n",
       " 'count': '10'}"
      ]
     },
     "execution_count": 54,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "id": "7248d936",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>id</th>\n",
       "      <th>location</th>\n",
       "      <th>type</th>\n",
       "      <th>typecode</th>\n",
       "      <th>pname</th>\n",
       "      <th>cityname</th>\n",
       "      <th>adname</th>\n",
       "      <th>address</th>\n",
       "      <th>pcode</th>\n",
       "      <th>citycode</th>\n",
       "      <th>adcode</th>\n",
       "      <th>photos</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>炸鸡队长(韩式炸鸡店)</td>\n",
       "      <td>B0FFHVMT24</td>\n",
       "      <td>113.676603,23.630170</td>\n",
       "      <td>餐饮服务;外国餐厅;韩国料理</td>\n",
       "      <td>050203</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>从化区</td>\n",
       "      <td>温泉镇中山大学南方学院南门</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440117</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>湖边纸包鱼</td>\n",
       "      <td>B0FFL7NUA2</td>\n",
       "      <td>113.679861,23.630285</td>\n",
       "      <td>餐饮服务;中餐厅;四川菜(川菜)</td>\n",
       "      <td>050102</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>从化区</td>\n",
       "      <td>广州南方学院</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440117</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>壹休盖饭</td>\n",
       "      <td>B0HRHG0RSP</td>\n",
       "      <td>113.679611,23.630517</td>\n",
       "      <td>餐饮服务;中餐厅;中餐厅</td>\n",
       "      <td>050100</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>从化区</td>\n",
       "      <td>温泉镇乌土村上围2队13号</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440117</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>鸡啤咯哒(中大店)</td>\n",
       "      <td>B0HROCMJ59</td>\n",
       "      <td>113.680035,23.631318</td>\n",
       "      <td>餐饮服务;外国餐厅;韩国料理</td>\n",
       "      <td>050203</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>从化区</td>\n",
       "      <td>温泉镇温泉乌土村随便公寓</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440117</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>井炙寿司(广州南方学院店)</td>\n",
       "      <td>B0G3VBBFDG</td>\n",
       "      <td>113.680297,23.630547</td>\n",
       "      <td>餐饮服务;外国餐厅;外国餐厅</td>\n",
       "      <td>050200</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>从化区</td>\n",
       "      <td>广州南方学院商业中心一楼</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440117</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Uni-hotel西餐</td>\n",
       "      <td>B0GR3OMDZ2</td>\n",
       "      <td>113.679222,23.632671</td>\n",
       "      <td>餐饮服务;外国餐厅;西餐厅(综合风味)</td>\n",
       "      <td>050201</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>从化区</td>\n",
       "      <td>温泉区广州南方学院</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440117</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>东记乡村美食</td>\n",
       "      <td>B0G3APADKJ</td>\n",
       "      <td>113.679283,23.632572</td>\n",
       "      <td>餐饮服务;中餐厅;中餐厅</td>\n",
       "      <td>050100</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>从化区</td>\n",
       "      <td>温泉镇广州南方学院后门润泰超市1层05号商铺</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440117</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>80后铁板烧</td>\n",
       "      <td>B0H6ZUSDBT</td>\n",
       "      <td>113.679405,23.632673</td>\n",
       "      <td>餐饮服务;外国餐厅;外国餐厅</td>\n",
       "      <td>050200</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>从化区</td>\n",
       "      <td>温泉镇广州南方学院后门润泰超市1层05号商铺</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440117</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>幸福楼酒店(温泉东路)</td>\n",
       "      <td>B00140FG8A</td>\n",
       "      <td>113.654186,23.644836</td>\n",
       "      <td>餐饮服务;中餐厅;中餐厅</td>\n",
       "      <td>050100</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>从化区</td>\n",
       "      <td>温泉镇温泉东路99号</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440117</td>\n",
       "      <td>[{'title': '', 'url': 'http://store.is.autonav...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>佳乐堡</td>\n",
       "      <td>B0FFKT7WD8</td>\n",
       "      <td>113.675576,23.620716</td>\n",
       "      <td>餐饮服务;快餐厅;快餐厅</td>\n",
       "      <td>050300</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>从化区</td>\n",
       "      <td>温泉镇乌土村松浪队</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440117</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            name          id              location                 type  \\\n",
       "0    炸鸡队长(韩式炸鸡店)  B0FFHVMT24  113.676603,23.630170       餐饮服务;外国餐厅;韩国料理   \n",
       "1          湖边纸包鱼  B0FFL7NUA2  113.679861,23.630285     餐饮服务;中餐厅;四川菜(川菜)   \n",
       "2           壹休盖饭  B0HRHG0RSP  113.679611,23.630517         餐饮服务;中餐厅;中餐厅   \n",
       "3      鸡啤咯哒(中大店)  B0HROCMJ59  113.680035,23.631318       餐饮服务;外国餐厅;韩国料理   \n",
       "4  井炙寿司(广州南方学院店)  B0G3VBBFDG  113.680297,23.630547       餐饮服务;外国餐厅;外国餐厅   \n",
       "5    Uni-hotel西餐  B0GR3OMDZ2  113.679222,23.632671  餐饮服务;外国餐厅;西餐厅(综合风味)   \n",
       "6         东记乡村美食  B0G3APADKJ  113.679283,23.632572         餐饮服务;中餐厅;中餐厅   \n",
       "7         80后铁板烧  B0H6ZUSDBT  113.679405,23.632673       餐饮服务;外国餐厅;外国餐厅   \n",
       "8    幸福楼酒店(温泉东路)  B00140FG8A  113.654186,23.644836         餐饮服务;中餐厅;中餐厅   \n",
       "9            佳乐堡  B0FFKT7WD8  113.675576,23.620716         餐饮服务;快餐厅;快餐厅   \n",
       "\n",
       "  typecode pname cityname adname                 address   pcode citycode  \\\n",
       "0   050203   广东省      广州市    从化区           温泉镇中山大学南方学院南门  440000      020   \n",
       "1   050102   广东省      广州市    从化区                  广州南方学院  440000      020   \n",
       "2   050100   广东省      广州市    从化区           温泉镇乌土村上围2队13号  440000      020   \n",
       "3   050203   广东省      广州市    从化区            温泉镇温泉乌土村随便公寓  440000      020   \n",
       "4   050200   广东省      广州市    从化区            广州南方学院商业中心一楼  440000      020   \n",
       "5   050201   广东省      广州市    从化区               温泉区广州南方学院  440000      020   \n",
       "6   050100   广东省      广州市    从化区  温泉镇广州南方学院后门润泰超市1层05号商铺  440000      020   \n",
       "7   050200   广东省      广州市    从化区  温泉镇广州南方学院后门润泰超市1层05号商铺  440000      020   \n",
       "8   050100   广东省      广州市    从化区              温泉镇温泉东路99号  440000      020   \n",
       "9   050300   广东省      广州市    从化区               温泉镇乌土村松浪队  440000      020   \n",
       "\n",
       "   adcode                                             photos  \n",
       "0  440117                                                NaN  \n",
       "1  440117  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "2  440117                                                NaN  \n",
       "3  440117                                                NaN  \n",
       "4  440117                                                NaN  \n",
       "5  440117                                                NaN  \n",
       "6  440117                                                NaN  \n",
       "7  440117                                                NaN  \n",
       "8  440117  [{'title': '', 'url': 'http://store.is.autonav...  \n",
       "9  440117                                                NaN  "
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.json_normalize(r.json()['pois'])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a6cfa7c1",
   "metadata": {},
   "source": [
    "## 3.多边形区域搜索"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "id": "ac3f1ddb",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 2.请求方法：GET\n",
    "# 3.请求的多边形区域搜索url地址：https://restapi.amap.com/v5/place/polygon?parameters\n",
    "polygon_url = \"https://restapi.amap.com/v5/place/polygon?parameters\"\n",
    "\n",
    "# 4.请求的参数（payload）\n",
    "payload = {\n",
    "    \"key\":\"091c69bb3b356e0f0eb237e4e7a62a45\",\n",
    "    \"types\":\"中餐厅|外国餐厅|快餐厅\",\n",
    "    \"polygon\":\"113.678280,23.628439|113.676603,23.630170\",\n",
    "    \"extensions\":\"all\",\n",
    "    \"show_fields\":\"photos\"\n",
    "}\n",
    "# 5.发起请求\n",
    "r = requests.get(url=polygon_url,params=payload)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "id": "845d2d4f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'status': '1',\n",
       " 'info': 'OK',\n",
       " 'infocode': '10000',\n",
       " 'pois': [{'name': '炸鸡队长(韩式炸鸡店)',\n",
       "   'id': 'B0FFHVMT24',\n",
       "   'location': '113.676603,23.630170',\n",
       "   'type': '餐饮服务;外国餐厅;韩国料理',\n",
       "   'typecode': '050203',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '温泉镇中山大学南方学院南门',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'}],\n",
       " 'count': '1'}"
      ]
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r.json()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "81190adb",
   "metadata": {},
   "source": [
    "## 4.ID搜索"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "id": "3f5bf3b7",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 2.请求方法：GET\n",
    "# 3.请求的ID搜索url地址：https://restapi.amap.com/v5/place/detail?parameters\n",
    "id_url = \"https://restapi.amap.com/v5/place/detail?parameters\"\n",
    "\n",
    "# 4.请求的参数（payload）\n",
    "payload = {\n",
    "    \"key\":\"091c69bb3b356e0f0eb237e4e7a62a45\",\n",
    "    \"id\":\"B0FFHVMT24|B0GR3OMDZ2|B0FFKT7WD8\",\n",
    "    \"extensions\":\"all\",\n",
    "    \"show_fields\":\"photos\"\n",
    "}\n",
    "# 5.发起请求\n",
    "r = requests.get(url=id_url,params=payload)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "id": "8ed1b5fb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'status': '1',\n",
       " 'info': 'OK',\n",
       " 'infocode': '10000',\n",
       " 'pois': [{'name': '炸鸡队长(韩式炸鸡店)',\n",
       "   'id': 'B0FFHVMT24',\n",
       "   'location': '113.676603,23.630170',\n",
       "   'type': '餐饮服务;外国餐厅;韩国料理',\n",
       "   'typecode': '050203',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '温泉镇中山大学南方学院南门',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'},\n",
       "  {'name': 'Uni-hotel西餐',\n",
       "   'id': 'B0GR3OMDZ2',\n",
       "   'location': '113.679222,23.632671',\n",
       "   'type': '餐饮服务;外国餐厅;西餐厅(综合风味)',\n",
       "   'typecode': '050201',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '温泉区广州南方学院',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'},\n",
       "  {'name': '佳乐堡',\n",
       "   'id': 'B0FFKT7WD8',\n",
       "   'location': '113.675576,23.620716',\n",
       "   'type': '餐饮服务;快餐厅;快餐厅',\n",
       "   'typecode': '050300',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '温泉镇乌土村松浪队',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'}],\n",
       " 'count': '3'}"
      ]
     },
     "execution_count": 62,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "id": "6a99844e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>id</th>\n",
       "      <th>location</th>\n",
       "      <th>type</th>\n",
       "      <th>typecode</th>\n",
       "      <th>pname</th>\n",
       "      <th>cityname</th>\n",
       "      <th>adname</th>\n",
       "      <th>address</th>\n",
       "      <th>pcode</th>\n",
       "      <th>citycode</th>\n",
       "      <th>adcode</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>炸鸡队长(韩式炸鸡店)</td>\n",
       "      <td>B0FFHVMT24</td>\n",
       "      <td>113.676603,23.630170</td>\n",
       "      <td>餐饮服务;外国餐厅;韩国料理</td>\n",
       "      <td>050203</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>从化区</td>\n",
       "      <td>温泉镇中山大学南方学院南门</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440117</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Uni-hotel西餐</td>\n",
       "      <td>B0GR3OMDZ2</td>\n",
       "      <td>113.679222,23.632671</td>\n",
       "      <td>餐饮服务;外国餐厅;西餐厅(综合风味)</td>\n",
       "      <td>050201</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>从化区</td>\n",
       "      <td>温泉区广州南方学院</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440117</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>佳乐堡</td>\n",
       "      <td>B0FFKT7WD8</td>\n",
       "      <td>113.675576,23.620716</td>\n",
       "      <td>餐饮服务;快餐厅;快餐厅</td>\n",
       "      <td>050300</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>从化区</td>\n",
       "      <td>温泉镇乌土村松浪队</td>\n",
       "      <td>440000</td>\n",
       "      <td>020</td>\n",
       "      <td>440117</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          name          id              location                 type  \\\n",
       "0  炸鸡队长(韩式炸鸡店)  B0FFHVMT24  113.676603,23.630170       餐饮服务;外国餐厅;韩国料理   \n",
       "1  Uni-hotel西餐  B0GR3OMDZ2  113.679222,23.632671  餐饮服务;外国餐厅;西餐厅(综合风味)   \n",
       "2          佳乐堡  B0FFKT7WD8  113.675576,23.620716         餐饮服务;快餐厅;快餐厅   \n",
       "\n",
       "  typecode pname cityname adname        address   pcode citycode  adcode  \n",
       "0   050203   广东省      广州市    从化区  温泉镇中山大学南方学院南门  440000      020  440117  \n",
       "1   050201   广东省      广州市    从化区      温泉区广州南方学院  440000      020  440117  \n",
       "2   050300   广东省      广州市    从化区      温泉镇乌土村松浪队  440000      020  440117  "
      ]
     },
     "execution_count": 63,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.json_normalize(r.json()['pois'])"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
